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
This commit is contained in:
jason@long.name 2013-04-07 00:14:55 +00:00
parent 19a3fcefd7
commit 1bbc20487f

View file

@ -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
}
}
}
}
}
}