Skip to content

Commit

Permalink
Add undefined check
Browse files Browse the repository at this point in the history
Defensive programming per last sentence of paragraph 8 in web3#3573 (comment)
  • Loading branch information
wbt authored Jun 8, 2020
1 parent 076fd46 commit a182d7a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/web3-providers-ws/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ WebsocketProvider.prototype._onMessage = function (e) {
}

if (_this.responseQueue.has(id)) {
_this.responseQueue.get(id).callback(false, result);
if(_this.responseQueue.get(id).callback !== undefined) {
_this.responseQueue.get(id).callback(false, result);
}
_this.responseQueue.delete(id);
}
});
Expand Down

0 comments on commit a182d7a

Please sign in to comment.