Prevent array index bounds problems if isOccupiedPlayer gets called
with -1 (I saw it happen entering a sword game as a watcher). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3613 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -179,7 +179,7 @@ public class GameObject extends PlaceObject
|
||||
*/
|
||||
public boolean isOccupiedPlayer (int pidx)
|
||||
{
|
||||
return (players[pidx] != null);
|
||||
return (pidx >= 0 && pidx < players.length) && (players[pidx] != null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user