state: Fix assertion errors

This commit is contained in:
Nathan Woodburn 2023-05-02 15:43:11 +10:00
parent 025d5af907
commit 8fdf5a2cdb
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -77,8 +77,9 @@ public class State {
islandcount++;
// Add the island to the array
Island[] tmpislands = new Island[islandcount];
assert islands != null;
System.arraycopy(islands, 0, tmpislands, 0, tmpislands.length - 1);
if (islands != null) {
System.arraycopy(islands, 0, tmpislands, 0, tmpislands.length - 1);
}
tmpislands[islandcount-1] = tmpIsland;
islands = tmpislands;
}