diff --git a/src/main/java/edu/rpi/legup/puzzle/nurikabe/NurikabeBoard.java b/src/main/java/edu/rpi/legup/puzzle/nurikabe/NurikabeBoard.java index d812d0d93..d5b83d1e8 100644 --- a/src/main/java/edu/rpi/legup/puzzle/nurikabe/NurikabeBoard.java +++ b/src/main/java/edu/rpi/legup/puzzle/nurikabe/NurikabeBoard.java @@ -15,6 +15,10 @@ public NurikabeBoard(int size) { @Override public NurikabeCell getCell(int x, int y) { + if (y * dimension.width + x >= puzzleElements.size() || x >= dimension.width || + y >= dimension.height || x < 0 || y < 0) { + return null; + } return (NurikabeCell) super.getCell(x, y); }