Skip to content

Commit 851bda2

Browse files
committed
Immediate return if not decoded.
1 parent ec32b20 commit 851bda2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ var TokenExpiredError = module.exports.TokenExpiredError = require('./lib/TokenE
66
module.exports.decode = function (jwt, options) {
77
options = options || {};
88
var decoded = jws.decode(jwt, options);
9-
var payload = decoded && decoded.payload;
9+
if (!decoded) { return null; }
10+
var payload = decoded.payload;
1011

1112
//try parse the payload
1213
if(typeof payload === 'string') {

0 commit comments

Comments
 (0)