GRF: Fix c0c9c66f: ObjectMapSpriteGroup with missing object specs

This commit is contained in:
Jonathan G Rennison
2023-02-12 12:59:36 +00:00
parent ae9b416684
commit b539799c0a

View File

@@ -6540,7 +6540,7 @@ static void ObjectMapSpriteGroup(ByteReader *buf, uint8 idcount)
if (ctype == CT_INVALID) continue; if (ctype == CT_INVALID) continue;
for (uint i = 0; i < idcount; i++) { for (uint i = 0; i < idcount; i++) {
ObjectSpec *spec = _cur.grffile->objectspec[objects[i]]; ObjectSpec *spec = (objects[i] >= _cur.grffile->objectspec.size()) ? nullptr : _cur.grffile->objectspec[objects[i]];
if (spec == nullptr) { if (spec == nullptr) {
grfmsg(1, "ObjectMapSpriteGroup: Object with ID 0x%02X undefined, skipping", objects[i]); grfmsg(1, "ObjectMapSpriteGroup: Object with ID 0x%02X undefined, skipping", objects[i]);
@@ -6555,7 +6555,7 @@ static void ObjectMapSpriteGroup(ByteReader *buf, uint8 idcount)
if (!IsValidGroupID(groupid, "ObjectMapSpriteGroup")) return; if (!IsValidGroupID(groupid, "ObjectMapSpriteGroup")) return;
for (uint i = 0; i < idcount; i++) { for (uint i = 0; i < idcount; i++) {
ObjectSpec *spec = _cur.grffile->objectspec[objects[i]]; ObjectSpec *spec = (objects[i] >= _cur.grffile->objectspec.size()) ? nullptr : _cur.grffile->objectspec[objects[i]];
if (spec == nullptr) { if (spec == nullptr) {
grfmsg(1, "ObjectMapSpriteGroup: Object with ID 0x%02X undefined, skipping", objects[i]); grfmsg(1, "ObjectMapSpriteGroup: Object with ID 0x%02X undefined, skipping", objects[i]);