(svn r22757) -Fix [FS#4730]: [NewGRF] Invalid memory access when querying the grfID of the default objects
This commit is contained in:
@@ -140,6 +140,11 @@ static uint32 GetObjectIDAtOffset(TileIndex tile, uint32 cur_grfid)
|
|||||||
|
|
||||||
const ObjectSpec *spec = ObjectSpec::GetByTile(tile);
|
const ObjectSpec *spec = ObjectSpec::GetByTile(tile);
|
||||||
|
|
||||||
|
/* Default objects have no associated NewGRF file */
|
||||||
|
if (spec->grf_prop.grffile == NULL) {
|
||||||
|
return 0xFFFE; // Defined in another grf file
|
||||||
|
}
|
||||||
|
|
||||||
if (spec->grf_prop.grffile->grfid == cur_grfid) { // same object, same grf ?
|
if (spec->grf_prop.grffile->grfid == cur_grfid) { // same object, same grf ?
|
||||||
return spec->grf_prop.local_id;
|
return spec->grf_prop.local_id;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user