Skip to content

Commit 77835ac

Browse files
committed
fix potential OOB
1 parent a6fe52a commit 77835ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/bwapi/Game.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ public Player getPlayer(final int playerID) {
365365
}
366366

367367
public Unit getUnit(final int unitID) {
368-
if (unitID < 0) {
368+
if (unitID < 0 || unitID >= units.length) {
369369
return null;
370370
}
371371
return units[unitID];

0 commit comments

Comments
 (0)