# HG changeset patch # User planetmaker # Date 1313676531 0 # Node ID 9a9306357aec4f0576ad883e61521d210f52bda8 # Parent c3398529019210e29dc9e2661266e213940ae2d5 (svn r22757) -Fix [FS#4730]: [NewGRF] Invalid memory access when querying the grfID of the default objects diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp --- a/src/newgrf_object.cpp +++ b/src/newgrf_object.cpp @@ -140,6 +140,11 @@ 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 ? return spec->grf_prop.local_id; }