summaryrefslogtreecommitdiff
path: root/newgrf.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-04-26 20:18:29 +0000
committerpeter1138 <peter1138@openttd.org>2006-04-26 20:18:29 +0000
commitb81e6dd6a2ab42524f66d456266ae2f6171ba08b (patch)
tree508ed6c316138d7aae749a30898d6905b75f6ff4 /newgrf.c
parent2b96c107fa99ba270b5f7e303279668110b38de9 (diff)
downloadopenttd-b81e6dd6a2ab42524f66d456266ae2f6171ba08b.tar.xz
(svn r4582) - NewGRF: include an additional check to see if a spriteset id is within range.
Diffstat (limited to 'newgrf.c')
-rw-r--r--newgrf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/newgrf.c b/newgrf.c
index 88e7f0875..f7c4d52b6 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -1319,6 +1319,11 @@ static SpriteGroup* CreateGroupFromGroupID(byte setid, byte type, uint16 spritei
{
if (HASBIT(spriteid, 15)) return NewCallBackResultSpriteGroup(spriteid);
+ if (spriteid >= _cur_grffile->spriteset_numsets) {
+ grfmsg(GMS_WARN, "NewSpriteGroup(0x%02X:0x%02X): Sprite set %u invalid, max %u", setid, type, spriteid, _cur_grffile->spriteset_numsets);
+ return NULL;
+ }
+
/* Check if the sprite is within range. This can fail if the Action 0x01
* is skipped, as TTDPatch mandates that Action 0x02s must be processed.
* We don't have that rule, but must live by the Patch... */