diff --git a/src/main/java/com/github/creme332/model/ShapeManager.java b/src/main/java/com/github/creme332/model/ShapeManager.java index bb52cf7..0d6499d 100644 --- a/src/main/java/com/github/creme332/model/ShapeManager.java +++ b/src/main/java/com/github/creme332/model/ShapeManager.java @@ -167,6 +167,10 @@ public void deleteShape(final int shapeIndex) { } public void editShape(final int oldShapeIndex, final ShapeWrapper newShape) { + if (newShape == null) { + throw new NullPointerException("Edit shape failed: Cannot replace a shape with null."); + } + final ShapeWrapper oldShape = shapes.get(oldShapeIndex); if (oldShapeIndex != -1) { shapes.set(oldShapeIndex, newShape);