diff --git a/Objects/DrawObject.java b/Objects/DrawObject.java index 22e5c7c..ccb0aec 100644 --- a/Objects/DrawObject.java +++ b/Objects/DrawObject.java @@ -190,8 +190,12 @@ public abstract class DrawObject { Shape ownShape = getRectangle(); Rectangle2D otherRectangle = object.getTransform().createTransformedShape(object.getImageRectangle()).getBounds2D(); - if (ownShape.intersects(otherRectangle)) - return true; + if(ownShape != null && otherRectangle != null) { + if (ownShape.intersects(otherRectangle)) + return true; + else + return false; + } else return false; }