summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-05-14 20:53:39 +0000
committerfrosch <frosch@openttd.org>2012-05-14 20:53:39 +0000
commitc11d80148f2e48b2ab67569c4cce64d9af953eaf (patch)
tree5dede1036ca99adc20630138e79616da40c7484f
parentce5c936b07517955ffa29a134907346b6cd4c148 (diff)
downloadopenttd-c11d80148f2e48b2ab67569c4cce64d9af953eaf.tar.xz
(svn r24247) -Fix: If loading of int-list settings fails, use the default.
-rw-r--r--src/settings.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index b9c70251d..74fb4b3ec 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -507,7 +507,8 @@ static void IniLoadSettings(IniFile *ini, const SettingDesc *sd, const char *grp
case SDT_NUMX:
case SDT_ONEOFMANY:
case SDT_MANYOFMANY:
- Write_ValidateSetting(ptr, sd, (int32)(size_t)p); break;
+ Write_ValidateSetting(ptr, sd, (int32)(size_t)p);
+ break;
case SDT_STRING:
switch (GetVarMemType(sld->conv)) {
@@ -532,6 +533,9 @@ static void IniLoadSettings(IniFile *ini, const SettingDesc *sd, const char *grp
if (!LoadIntList((const char*)p, ptr, sld->length, GetVarMemType(sld->conv))) {
SetDParamStr(0, sdb->name);
ShowErrorMessage(STR_CONFIG_ERROR, STR_CONFIG_ERROR_ARRAY, WL_CRITICAL);
+
+ /* Use default */
+ LoadIntList((const char*)sdb->def, ptr, sld->length, GetVarMemType(sld->conv));
} else if (sd->desc.proc_cnvt != NULL) {
sd->desc.proc_cnvt((const char*)p);
}