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 | 77ff05a5f1ac85a48172cd6f97f6ddac87915dce (patch) | |
tree | ff99a40740d45e4276135f1a894cd602e9c0a2b6 /src | |
parent | a43c7af33bd76d346be4fe40cb614d894e789aa3 (diff) | |
download | openttd-77ff05a5f1ac85a48172cd6f97f6ddac87915dce.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; |