summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/newgrf_object.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp
index b27f4c564..395234ee1 100644
--- a/src/newgrf_object.cpp
+++ b/src/newgrf_object.cpp
@@ -95,7 +95,8 @@ INSTANTIATE_NEWGRF_CLASS_METHODS(ObjectClass, ObjectSpec, ObjectClassID, OBJECT_
static uint32 ObjectGetRandomBits(const ResolverObject *object)
{
- return IsTileType(object->u.object.tile, MP_OBJECT) ? GetObjectRandomBits(object->u.object.tile) : 0;
+ TileIndex t = object->u.object.tile;
+ return IsValidTile(t) && IsTileType(t, MP_OBJECT) ? GetObjectRandomBits(t) : 0;
}
static uint32 ObjectGetTriggers(const ResolverObject *object)