Skip to content

Commit

Permalink
corrected checking for a blank eventTypes array
Browse files Browse the repository at this point in the history
Apparently, [] in javascript is a truth value, so just checking if(eventTypes) will always be true as long as eventTypes is an array.
  • Loading branch information
sirpython committed Sep 9, 2015
1 parent a9bd789 commit a3b74eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/server_interface/server_interface.js
Expand Up @@ -284,7 +284,7 @@ var CardshifterServerAPI = {

this.socket.onmessage = function(message) {
var data = JSON.parse(message.data);
if(eventTypes) {
if(eventTypes !== []) {
if(eventTypes.indexOf(data.command) !== -1) { // if contains
listener(data);
}
Expand Down

0 comments on commit a3b74eb

Please sign in to comment.