From 21cf75951c77e2d73ba2a564e2b7110c5c058747 Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 30 Nov 2010 14:11:29 +0000 Subject: [PATCH] (svn r21360) -Fix [FS#4281]: crash when randomised action2 was used when resolving the image to draw in the buy menu --- src/newgrf_object.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp index b27f4c5648..395234ee1b 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)