Skip to content

Commit

Permalink
C2DM registers itself for the event via the handler, which receives a…
Browse files Browse the repository at this point in the history
…n error and token, but captureToken needs to check that there is no error and that the token exists before attempting to perform a regex match on the token, otherwise we throw an exception that nobody can catch because we're in an unwrapped event handler
  • Loading branch information
Jesse Thompson committed Jul 17, 2013
1 parent 1ea1ae0 commit a754959
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/c2dm.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ util.inherits(C2DM, emitter);
exports.C2DM = C2DM;

C2DM.prototype.captureToken = function(err, token) {
token = 'auth=' + token.replace(/Auth=/i,'');
this.token = token;
if (!err && token) {
token = 'auth=' + token.replace(/Auth=/i,'');
this.token = token;
}
};

C2DM.prototype.login = function(cb) {
Expand Down

0 comments on commit a754959

Please sign in to comment.