Mercurial > hg > openttd
changeset 3573:98fe5c3f5ccc draft
(svn r4459) - Newstations: check pointer for NULL before using it.
author | peter1138 <peter1138@openttd.org> |
---|---|
date | Mon, 17 Apr 2006 18:35:44 +0000 |
parents | e8a4d45e3ea0 |
children | 41b8e2140ac7 |
files | newgrf_station.c |
diffstat | 1 files changed, 2 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/newgrf_station.c +++ b/newgrf_station.c @@ -117,6 +117,7 @@ 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 @@ 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;