From b14dd861137fa96b60089c673b43be84c810dff0 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Tue, 4 Dec 2018 22:04:47 +0100 Subject: Fix NullPointerException on MapScene.tileAtCoordinates() --- src/subconscious/graphics/MapScene.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/subconscious/graphics/MapScene.java b/src/subconscious/graphics/MapScene.java index a198542..fb590ac 100644 --- a/src/subconscious/graphics/MapScene.java +++ b/src/subconscious/graphics/MapScene.java @@ -38,8 +38,8 @@ public abstract class MapScene extends Scene { protected AffineTransform applyZoomTx = new AffineTransform(); protected AffineTransform applyPanTx = new AffineTransform(); - protected AffineTransform undoZoomTx; - protected AffineTransform undoPanTx; + protected AffineTransform undoZoomTx = null; + protected AffineTransform undoPanTx = null; // rendering settings protected boolean renderTileBorder = true; @@ -74,6 +74,10 @@ public abstract class MapScene extends Scene { public Point tileAtCoordinates(Point screenPos) { Rectangle mapRect = new Rectangle(0, 0, this.map.getSize(), this.map.getSize()); + if (undoZoomTx == null || undoPanTx == null) { + return null; + } + // undo zoom undoZoomTx.transform(screenPos, screenPos); -- cgit v1.2.1