Skip to content

Check payload is not null when decoded.#444

Merged
ziluvatar merged 3 commits intoauth0:masterfrom
Gp2mv3:master
Apr 5, 2018
Merged

Check payload is not null when decoded.#444
ziluvatar merged 3 commits intoauth0:masterfrom
Gp2mv3:master

Conversation

@Gp2mv3
Copy link
Copy Markdown
Contributor

@Gp2mv3 Gp2mv3 commented Feb 13, 2018

Fixed "Cannot read property 'nbf' of null" fixes #430

Fixed "Cannot read property 'nbf' of null"
decode.js Outdated
try {
var obj = JSON.parse(payload);
if(typeof obj === 'object') {
if(obj && typeof obj === 'object') {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test?

decode.js Outdated
try {
var obj = JSON.parse(payload);
if(typeof obj === 'object') {
if(obj && typeof obj === 'object') {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make more sense to check that obj !== null here instead? Might make it more clear that the additional condition is to guard against typeof null => 'object'.

@ziluvatar ziluvatar merged commit 1232ae9 into auth0:master Apr 5, 2018
@ziluvatar
Copy link
Copy Markdown
Contributor

ziluvatar commented Apr 5, 2018

@Gp2mv3 this has been released on v8.2.1 🎉

Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check payload before trying to get nbf

3 participants