diff options
author | frosch <frosch@openttd.org> | 2008-06-07 00:06:36 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2008-06-07 00:06:36 +0000 |
commit | 5dd138750818c16cae4753350f79dd4c675b6b4a (patch) | |
tree | ff99a40740d45e4276135f1a894cd602e9c0a2b6 /src | |
parent | 6d3f35af8f1d94b536e7d26cbc051d8229154759 (diff) | |
download | openttd-5dd138750818c16cae4753350f79dd4c675b6b4a.tar.xz |
(svn r13397) -Fix: Do not crash when resolving vehicle sprite groups with zero sprites.
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf_engine.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index f809fcc67..7bf56d53b 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -880,7 +880,7 @@ SpriteID GetCustomEngineSprite(EngineID engine, const Vehicle *v, Direction dire NewVehicleResolver(&object, engine, v); group = Resolve(GetVehicleSpriteGroup(engine, v), &object); - if (group == NULL || group->type != SGT_RESULT) return 0; + if (group == NULL || group->type != SGT_RESULT || group->g.result.num_sprites == 0) return 0; return group->g.result.sprite + (direction % group->g.result.num_sprites); } @@ -903,7 +903,7 @@ SpriteID GetRotorOverrideSprite(EngineID engine, const Vehicle *v, bool info_vie const SpriteGroup *group = GetWagonOverrideSpriteSet(engine, CT_DEFAULT, engine); group = Resolve(group, &object); - if (group == NULL || group->type != SGT_RESULT) return 0; + if (group == NULL || group->type != SGT_RESULT || group->g.result.num_sprites == 0) return 0; if (v == NULL) return group->g.result.sprite; |