Skip to content

Commit

Permalink
throw null exception in editShape
Browse files Browse the repository at this point in the history
  • Loading branch information
creme332 committed Aug 10, 2024
1 parent f2eb275 commit 8b85150
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/github/creme332/model/ShapeManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8b85150

Please sign in to comment.