mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-29 09:29:10 +00:00
Fix: Check station ID is within bounds when copying layouts.
This commit is contained in:
@@ -2000,7 +2000,7 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, Byte
|
||||
|
||||
case 0x0A: { // Copy sprite layout
|
||||
byte srcid = buf->ReadByte();
|
||||
const StationSpec *srcstatspec = _cur.grffile->stations[srcid];
|
||||
const StationSpec *srcstatspec = srcid >= NUM_STATIONS_PER_GRF ? nullptr : _cur.grffile->stations[srcid];
|
||||
|
||||
if (srcstatspec == nullptr) {
|
||||
grfmsg(1, "StationChangeInfo: Station %u is not defined, cannot copy sprite layout to %u.", srcid, stid + i);
|
||||
@@ -2054,7 +2054,7 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, Byte
|
||||
|
||||
case 0x0F: { // Copy custom layout
|
||||
byte srcid = buf->ReadByte();
|
||||
const StationSpec *srcstatspec = _cur.grffile->stations[srcid];
|
||||
const StationSpec *srcstatspec = srcid >= NUM_STATIONS_PER_GRF ? nullptr : _cur.grffile->stations[srcid];
|
||||
|
||||
if (srcstatspec == nullptr) {
|
||||
grfmsg(1, "StationChangeInfo: Station %u is not defined, cannot copy tile layout to %u.", srcid, stid + i);
|
||||
|
Reference in New Issue
Block a user