summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-12-04 22:04:47 +0100
committerNao Pross <naopross@thearcway.org>2018-12-04 22:04:47 +0100
commitb14dd861137fa96b60089c673b43be84c810dff0 (patch)
tree51eb85be7f701b1f4a1fd907768bd3bae5bd2a71 /src
parentReplace old BattleScene code with new impl from WorldScene (diff)
downloadSubconscious-java-b14dd861137fa96b60089c673b43be84c810dff0.tar.gz
Subconscious-java-b14dd861137fa96b60089c673b43be84c810dff0.zip
Fix NullPointerException on MapScene.tileAtCoordinates()
Diffstat (limited to 'src')
-rw-r--r--src/subconscious/graphics/MapScene.java8
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);