correct bound checking
This commit is contained in:
parent
71df36594d
commit
2e681a9c0b
|
@ -556,7 +556,7 @@ function handleCommand(cmdNumber, message, response) {
|
|||
case "rack":
|
||||
rack = game.getPlayerRack(playerName);
|
||||
|
||||
if (cmd.indexFrom > 6 || cmd.indexFrom < 0) {
|
||||
if (cmd.indexFrom > rackLength - 1 || cmd.indexFrom < 0) {
|
||||
reply(message, response, cmdNumber, {error: 1, reason: "Wrong indexFrom"});
|
||||
return false;
|
||||
}
|
||||
|
@ -601,7 +601,7 @@ function handleCommand(cmdNumber, message, response) {
|
|||
|
||||
switch (cmd.to) {
|
||||
case "rack":
|
||||
if (cmd.indexTo < 0 || cmd.indexTo > 6) {
|
||||
if (cmd.indexTo < 0 || cmd.indexTo > rackLength - 1) {
|
||||
reply(message, response, cmdNumber, {error: 1, reason: "Wrong indexTo"});
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue