summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-04-20 21:38:20 +0000
committerpeter1138 <peter1138@openttd.org>2008-04-20 21:38:20 +0000
commitb418ee5a4ce39acb7f7ac38558552de5e251ae48 (patch)
treee5f3689a0bbc6be3500e6f46a895e331d2e1e330
parentf7d3d879c56c1eb0aa8b8eebf4f8086cf42253c8 (diff)
downloadopenttd-b418ee5a4ce39acb7f7ac38558552de5e251ae48.tar.xz
(svn r12809) -Fix (r1704): Possible out of bounds array access.
-rw-r--r--src/aircraft_cmd.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index b96a87e04..e1ebdba0f 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -191,15 +191,17 @@ void DrawAircraftEngine(int x, int y, EngineID engine, SpriteID pal)
{
const AircraftVehicleInfo* avi = AircraftVehInfo(engine);
int spritenum = avi->image_index;
- SpriteID sprite = (6 + _aircraft_sprite[spritenum]);
+ SpriteID sprite = 0;
if (is_custom_sprite(spritenum)) {
sprite = GetCustomVehicleIcon(engine, DIR_W);
if (sprite == 0) {
spritenum = _orig_aircraft_vehicle_info[engine - AIRCRAFT_ENGINES_INDEX].image_index;
- sprite = (6 + _aircraft_sprite[spritenum]);
}
}
+ if (sprite == 0) {
+ sprite = 6 + _aircraft_sprite[spritenum];
+ }
DrawSprite(sprite, pal, x, y);