From 1bbc20487f4a321126b39f4292ac0083974787e7 Mon Sep 17 00:00:00 2001 From: "jason@long.name" Date: Sun, 7 Apr 2013 00:14:55 +0000 Subject: [PATCH] overlay-map: add sanity check for tile value before indexing a tile git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@605 d9718cc8-9f43-0410-858b-315f434eb58c --- src/micropolisj/gui/OverlayMapView.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/micropolisj/gui/OverlayMapView.java b/src/micropolisj/gui/OverlayMapView.java index 9e21b4f..c6c6b42 100644 --- a/src/micropolisj/gui/OverlayMapView.java +++ b/src/micropolisj/gui/OverlayMapView.java @@ -325,7 +325,11 @@ public class OverlayMapView extends JComponent default: } + // tile == -1 means it's already been drawn + // in the checkPower function + if (tile != -1) { + if (tile >= 0 && tile <= LAST_TILE) { for (int yy = 0; yy < TILE_HEIGHT; yy++) { for (int xx = 0; xx < TILE_WIDTH; xx++) @@ -335,6 +339,7 @@ public class OverlayMapView extends JComponent } } } + } } }