mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-02 09:40:35 +00:00
(svn r14297) -Fix: one could be trying to get the station name of a station that is outside of the pool.
This commit is contained in:
parent
e9a3ed016d
commit
7f461f0bba
@ -838,11 +838,18 @@ static char* FormatString(char* buff, const char* str, const int64* argv, uint c
|
|||||||
}
|
}
|
||||||
|
|
||||||
case SCC_STATION_NAME: { // {STATION}
|
case SCC_STATION_NAME: { // {STATION}
|
||||||
const Station* st = GetStation(GetInt32(&argv));
|
StationID sid = GetInt32(&argv);
|
||||||
|
|
||||||
if (!st->IsValid()) { // station doesn't exist anymore
|
if (!IsValidStationID(sid)) {
|
||||||
|
/* The station doesn't exist anymore. The only place where we might
|
||||||
|
* be "drawing" an invalid station is in the case of cargo that is
|
||||||
|
* in transit. */
|
||||||
buff = GetStringWithArgs(buff, STR_UNKNOWN_DESTINATION, NULL, last);
|
buff = GetStringWithArgs(buff, STR_UNKNOWN_DESTINATION, NULL, last);
|
||||||
} else if (st->name != NULL) {
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Station *st = GetStation(sid);
|
||||||
|
if (st->name != NULL) {
|
||||||
buff = strecpy(buff, st->name, last);
|
buff = strecpy(buff, st->name, last);
|
||||||
} else {
|
} else {
|
||||||
int64 temp[3];
|
int64 temp[3];
|
||||||
|
Loading…
Reference in New Issue
Block a user