summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-04-17 18:35:44 +0000
committerpeter1138 <peter1138@openttd.org>2006-04-17 18:35:44 +0000
commit71b530dfe24593e8f0cb2f5799063afb316db4cd (patch)
treee114dfe9af1e581cc6170406ef78450d2b260962
parent3a06cbf1953315c9821a3bd9cbc70a0e913bdd7a (diff)
downloadopenttd-71b530dfe24593e8f0cb2f5799063afb316db4cd.tar.xz
(svn r4459) - Newstations: check pointer for NULL before using it.
-rw-r--r--newgrf_station.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/newgrf_station.c b/newgrf_station.c
index 2bb9e56ff..114152b26 100644
--- a/newgrf_station.c
+++ b/newgrf_station.c
@@ -117,6 +117,7 @@ const StationSpec *GetCustomStation(StationClassID sclass, uint station)
static const RealSpriteGroup *ResolveStationSpriteGroup(const SpriteGroup *spg, const Station *st)
{
+ if (spg == NULL) return NULL;
switch (spg->type) {
case SGT_REAL:
return &spg->g.real;
@@ -183,6 +184,7 @@ static const RealSpriteGroup *ResolveStationSpriteGroup(const SpriteGroup *spg,
uint32 GetCustomStationRelocation(const StationSpec *spec, const Station *st, byte ctype)
{
const RealSpriteGroup *rsg = ResolveStationSpriteGroup(spec->spritegroup[ctype], st);
+ if (rsg == NULL) return 0;
if (rsg->sprites_per_set != 0) {
if (rsg->loading_count != 0) return rsg->loading[0]->g.result.result;