summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-16 00:06:51 +0000
committerrubidium <rubidium@openttd.org>2009-12-16 00:06:51 +0000
commitf0728ca1d16b88a9327313e115554e3c6ff0a93f (patch)
tree77faffbf8467d14a0a18568276466878b425c76a /src
parent35b8c8367eeea8ccd1832b15169d3c93e4437c04 (diff)
downloadopenttd-f0728ca1d16b88a9327313e115554e3c6ff0a93f.tar.xz
(svn r18513) -Fix [FS#3379]: sometimes NewGRFs throw invalid data at OpenTTD and that triggered a check... that if a has to be between b and c (inclusive) then c must be bigger than or equal to b (and definitely not smaller)
Diffstat (limited to 'src')
-rw-r--r--src/newgrf_industrytiles.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index a661fd018..08ecac408 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -253,10 +253,10 @@ bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const Indus
NewIndustryTileResolver(&object, gfx, ti->tile, i);
group = SpriteGroup::Resolve(inds->grf_prop.spritegroup, &object);
- if (group == NULL || group->type != SGT_TILELAYOUT) {
+ const TileLayoutSpriteGroup *tlgroup = (const TileLayoutSpriteGroup *)group;
+ if (group == NULL || group->type != SGT_TILELAYOUT || tlgroup->num_sprites == 0) {
return false;
} else {
- const TileLayoutSpriteGroup *tlgroup = (const TileLayoutSpriteGroup *)group;
/* Limit the building stage to the number of stages supplied. */
byte stage = GetIndustryConstructionStage(ti->tile);
stage = Clamp(stage - 4 + tlgroup->num_sprites, 0, tlgroup->num_sprites - 1);