summaryrefslogtreecommitdiff
path: root/src/newgrf_object.cpp
diff options
context:
space:
mode:
authorplanetmaker <planetmaker@openttd.org>2011-08-18 14:08:51 +0000
committerplanetmaker <planetmaker@openttd.org>2011-08-18 14:08:51 +0000
commit86234253a53834aec953376282ef6a849ee173b9 (patch)
tree006978d297a09cd2bb14fbd386c78c1428d34130 /src/newgrf_object.cpp
parent2dd798149b5567dd7877266f7d53b843b2f287cd (diff)
downloadopenttd-86234253a53834aec953376282ef6a849ee173b9.tar.xz
(svn r22757) -Fix [FS#4730]: [NewGRF] Invalid memory access when querying the grfID of the default objects
Diffstat (limited to 'src/newgrf_object.cpp')
-rw-r--r--src/newgrf_object.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp
index 6582e8eca..41735b7fa 100644
--- a/src/newgrf_object.cpp
+++ b/src/newgrf_object.cpp
@@ -140,6 +140,11 @@ static uint32 GetObjectIDAtOffset(TileIndex tile, uint32 cur_grfid)
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;
}