diff options
author | Nao Pross <naopross@thearcway.org> | 2018-12-04 22:04:47 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-12-04 22:04:47 +0100 |
commit | b14dd861137fa96b60089c673b43be84c810dff0 (patch) | |
tree | 51eb85be7f701b1f4a1fd907768bd3bae5bd2a71 /src | |
parent | Replace old BattleScene code with new impl from WorldScene (diff) | |
download | Subconscious-java-b14dd861137fa96b60089c673b43be84c810dff0.tar.gz Subconscious-java-b14dd861137fa96b60089c673b43be84c810dff0.zip |
Fix NullPointerException on MapScene.tileAtCoordinates()
Diffstat (limited to '')
-rw-r--r-- | src/subconscious/graphics/MapScene.java | 8 |
1 files 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); |