Skip to content

Commit

Permalink
Immediate return if not decoded.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhanson committed May 15, 2015
1 parent ec32b20 commit 851bda2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ var TokenExpiredError = module.exports.TokenExpiredError = require('./lib/TokenE
module.exports.decode = function (jwt, options) {
options = options || {};
var decoded = jws.decode(jwt, options);
var payload = decoded && decoded.payload;
if (!decoded) { return null; }
var payload = decoded.payload;

//try parse the payload
if(typeof payload === 'string') {
Expand Down

0 comments on commit 851bda2

Please sign in to comment.