changeset 17948:9a9306357aec draft

(svn r22757) -Fix [FS#4730]: [NewGRF] Invalid memory access when querying the grfID of the default objects
author planetmaker <planetmaker@openttd.org>
date Thu, 18 Aug 2011 14:08:51 +0000
parents c33985290192
children 43fceab69f1a
files src/newgrf_object.cpp
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;
 	}