mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-04 06:00:15 +00:00
(svn r24192) -Fix [FS#5153-ish]: Also use default value when reading an invalid integer setting value.
This commit is contained in:
parent
f0b2de579f
commit
43ac4de940
@ -347,6 +347,12 @@ static const void *StringToVal(const SettingDescBase *desc, const char *orig_str
|
||||
case SDT_NUMX: {
|
||||
char *end;
|
||||
size_t val = strtoul(str, &end, 0);
|
||||
if (end == str) {
|
||||
SetDParamStr(0, str);
|
||||
SetDParamStr(1, desc->name);
|
||||
ShowErrorMessage(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_VALUE, WL_CRITICAL);
|
||||
return desc->def;
|
||||
}
|
||||
if (*end != '\0') {
|
||||
SetDParamStr(0, desc->name);
|
||||
ShowErrorMessage(STR_CONFIG_ERROR, STR_CONFIG_ERROR_TRAILING_CHARACTERS, WL_CRITICAL);
|
||||
|
Loading…
Reference in New Issue
Block a user