Skip to content

Commit

Permalink
Add undefined check (#3574)
Browse files Browse the repository at this point in the history
Defensive programming per last sentence of paragraph 8 in #3573 (comment)
  • Loading branch information
wbt authored Jun 19, 2020
1 parent aebe49f commit 4558b27
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 4558b27

Please sign in to comment.