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:
Ray Greenwell
2005-06-22 19:59:51 +00:00
parent dfa9216b89
commit 80ac008f24
@@ -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);
}
/**