summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2010-01-27 10:17:09 +0000
committerpeter1138 <peter1138@openttd.org>2010-01-27 10:17:09 +0000
commitcd6eac77c37e07c1e51856ae94a69b4aa8cd8af9 (patch)
tree26fd2703bc8948a0578743aae2798f8b5e77d563 /src/newgrf.cpp
parent4df90cddee54ca1fa8c76caf3c14a7194d24dd07 (diff)
downloadopenttd-cd6eac77c37e07c1e51856ae94a69b4aa8cd8af9.tar.xz
(svn r18923) -Fix [FS#3565]: Check source stationspec exists before copying layouts.
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 7a01757b5..6eb357fe5 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -1193,6 +1193,11 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, Byte
byte srcid = buf->ReadByte();
const StationSpec *srcstatspec = _cur_grffile->stations[srcid];
+ if (srcstatspec == NULL) {
+ grfmsg(1, "StationChangeInfo: Station %u is not defined, cannot copy sprite layout to %u.", srcid, stid + i);
+ continue;
+ }
+
statspec->tiles = srcstatspec->tiles;
statspec->renderdata = srcstatspec->renderdata;
statspec->copied_renderdata = true;
@@ -1266,6 +1271,11 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, Byte
byte srcid = buf->ReadByte();
const StationSpec *srcstatspec = _cur_grffile->stations[srcid];
+ if (srcstatspec == NULL) {
+ grfmsg(1, "StationChangeInfo: Station %u is not defined, cannot copy tile layout to %u.", srcid, stid + i);
+ continue;
+ }
+
statspec->lengths = srcstatspec->lengths;
statspec->platforms = srcstatspec->platforms;
statspec->layouts = srcstatspec->layouts;