Make sure keys are always only integers
This commit is contained in:
parent
a8f951fad4
commit
e929920677
1 changed files with 3 additions and 3 deletions
|
@ -45,7 +45,7 @@ function Room(domElem, lib) {
|
||||||
session.key = sessionKey;
|
session.key = sessionKey;
|
||||||
lib.clearElement(playersList);
|
lib.clearElement(playersList);
|
||||||
for(var key in playersHash) {
|
for(var key in playersHash) {
|
||||||
enter(key, playersHash[key] || "anon");
|
enter(parseInt(key), playersHash[key] || "anon");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,9 +60,9 @@ function Room(domElem, lib) {
|
||||||
|
|
||||||
function leave(key) {
|
function leave(key) {
|
||||||
var player = players[key];
|
var player = players[key];
|
||||||
if(key == session.key) {
|
if(key === session.key) {
|
||||||
off();
|
off();
|
||||||
} else if(key == session.selected) {
|
} else if(key === session.selected) {
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
if(player != undefined) {
|
if(player != undefined) {
|
||||||
|
|
Loading…
Reference in a new issue