summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-11-30 14:11:29 +0000
committerrubidium <rubidium@openttd.org>2010-11-30 14:11:29 +0000
commit21cf75951c77e2d73ba2a564e2b7110c5c058747 (patch)
tree5de2dffc238e41ccf34e9fe106bb302cb9b5f3b6 /src
parentb6c2216749765e4d29fc3fa05dc1023c2c643cce (diff)
downloadopenttd-21cf75951c77e2d73ba2a564e2b7110c5c058747.tar.xz
(svn r21360) -Fix [FS#4281]: crash when randomised action2 was used when resolving the image to draw in the buy menu
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)