mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-04 06:00:15 +00:00
(svn r11233) -Fix [FS#1303]: handle some wrong written station NewGRFs a little more gracefully than segfaulting.
This commit is contained in:
parent
7810424862
commit
ffba1cc208
@ -2864,6 +2864,12 @@ static void StationMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount)
|
||||
for (uint i = 0; i < idcount; i++) {
|
||||
uint8 stid = buf[3 + i];
|
||||
StationSpec *statspec = _cur_grffile->stations[stid];
|
||||
|
||||
if (statspec == NULL) {
|
||||
grfmsg(1, "StationMapSpriteGroup: Station with ID 0x%02X does not exist, skipping", stid);
|
||||
return;
|
||||
}
|
||||
|
||||
byte *bp = &buf[4 + idcount];
|
||||
|
||||
for (uint c = 0; c < cidcount; c++) {
|
||||
@ -2896,6 +2902,10 @@ static void StationMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount)
|
||||
for (uint i = 0; i < idcount; i++) {
|
||||
uint8 stid = buf[3 + i];
|
||||
StationSpec *statspec = _cur_grffile->stations[stid];
|
||||
if (statspec == NULL) {
|
||||
grfmsg(1, "StationMapSpriteGroup: Station with ID 0x%02X does not exist, skipping", stid);
|
||||
continue;
|
||||
}
|
||||
|
||||
statspec->spritegroup[CT_DEFAULT] = _cur_grffile->spritegroups[groupid];
|
||||
statspec->grffile = _cur_grffile;
|
||||
|
Loading…
Reference in New Issue
Block a user