这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Aug 23, 2024. It is now read-only.

Fixes crash for when @token is null #143

Merged
merged 1 commit into from
Oct 1, 2014
Merged

Conversation

waltfy
Copy link
Contributor

@waltfy waltfy commented Oct 1, 2014

Due to:

typeof null // "object"

Leading to the subsequent operation -> @{null}.username which in turn throws:

TypeError: Cannot read property 'username' of null

```javascript typeof null // "object"``` leading to the subsequent operation -> `@{null}.username` which in turn throws:

```
  TypeError: Cannot read property 'username' of null
```
@pksunkara
Copy link
Owner

It would give an error when @token is string.

@waltfy
Copy link
Contributor Author

waltfy commented Oct 1, 2014

I believe that the result of accessing a property on a String is the following:

"username".something // undefined

Before submitting this PR I have run tests where @token was equal to the following values:

{ username: 'user', password: 'pass' } // "user:pass"
null // ""
1 // ""
{} // ""
undefined // ""
"string" // ""

Which I believe is the expected behaviour? Let me know if not.

pksunkara added a commit that referenced this pull request Oct 1, 2014
Fixes crash for when `@token` is `null`
@pksunkara pksunkara merged commit d0b7738 into pksunkara:master Oct 1, 2014
@waltfy waltfy deleted the patch-1 branch October 2, 2014 12:04
pksunkara added a commit that referenced this pull request Oct 4, 2014
@trevorah
Copy link
Contributor

trevorah commented Oct 6, 2014

Any chance of a 0.6.8 release of this @pksunkara? I've tested it locally, and it seems to be working.

@pksunkara
Copy link
Owner

@trevorah Done. Released v0.6.8

@trevorah
Copy link
Contributor

trevorah commented Oct 6, 2014

Thanks @pksunkara! 🎉

@waltfy
Copy link
Contributor Author

waltfy commented Oct 6, 2014

@pksunkara 🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants