Skip to content

Commit

Permalink
Check for null and undefined explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
buremba committed Jul 7, 2016
1 parent e921efb commit 84e8b2a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions rakam.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,8 @@ Rakam.prototype.setUserId = function (userId) {
var previousUserId = this.options.userId;
this.options.userId = (userId !== undefined && userId !== null && ('' + userId)) || null;

if (userId !== null && userId !== undefined && ((this._eventId > 0 && previousUserId === null) ||
(previousUserId !== null && this.deviceIdCreatedAt !== undefined))) {
if (userId !== null && userId !== undefined && ((this._eventId > 0 && (previousUserId === null || previousUserId === undefined)) ||
(previousUserId !== null && previousUserId !== undefined && this.deviceIdCreatedAt !== undefined))) {
var _this = this;
this.User()._merge(previousUserId, this.deviceIdCreatedAt, function () {
_this.deviceIdCreatedAt = undefined;
Expand Down
Loading

0 comments on commit 84e8b2a

Please sign in to comment.