diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 9cebb7a59..ce1b2babe 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -7941,8 +7941,14 @@ static bool ChangeGRFParamLimits(size_t len, ByteReader *buf) grfmsg(2, "StaticGRFInfo: expected 8 bytes for 'INFO'->'PARA'->'LIMI' but got " PRINTF_SIZE ", ignoring this field", len); buf->Skip(len); } else { - _cur_parameter->min_value = buf->ReadDWord(); - _cur_parameter->max_value = buf->ReadDWord(); + uint32 min_value = buf->ReadDWord(); + uint32 max_value = buf->ReadDWord(); + if (min_value <= max_value) { + _cur_parameter->min_value = min_value; + _cur_parameter->max_value = max_value; + } else { + grfmsg(2, "StaticGRFInfo: 'INFO'->'PARA'->'LIMI' values are incoherent, ignoring this field"); + } } return true; } |