Mercurial > hg > openttd
changeset 9012:249c563c330a draft
(svn r12809) -Fix (r1704): Possible out of bounds array access.
author | peter1138 <peter1138@openttd.org> |
---|---|
date | Sun, 20 Apr 2008 21:38:20 +0000 |
parents | 66fc4316eb79 |
children | 67f8acdd5b3c |
files | src/aircraft_cmd.cpp |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -191,15 +191,17 @@ { 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);