summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-02-11 15:12:08 +0000
committeryexo <yexo@openttd.org>2010-02-11 15:12:08 +0000
commit804a6894c53416aef9e2cce02cb5deec3ec67bfa (patch)
tree473cc5b0b715ad5764b5b5b04569bc7a06dbe6a5
parentf70929022017d6f1cd8538cc2a26614e5fbd7e19 (diff)
downloadopenttd-804a6894c53416aef9e2cce02cb5deec3ec67bfa.tar.xz
(svn r19096) -Fix: segfault when one of the items in the news_display group in the config file has no value
-rw-r--r--src/settings.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index 42776fc0f..9c9dd1f37 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1133,14 +1133,17 @@ static void NewsDisplayLoadConfig(IniFile *ini, const char *grpname)
continue;
}
- if (strcasecmp(item->value, "full") == 0) {
+ if (StrEmpty(item->value)) {
+ DEBUG(misc, 0, "Empty display value for newstype %s", item->name);
+ continue;
+ } else if (strcasecmp(item->value, "full") == 0) {
_news_type_data[news_item].display = ND_FULL;
} else if (strcasecmp(item->value, "off") == 0) {
_news_type_data[news_item].display = ND_OFF;
} else if (strcasecmp(item->value, "summarized") == 0) {
_news_type_data[news_item].display = ND_SUMMARY;
} else {
- DEBUG(misc, 0, "Invalid display value: %s", item->value);
+ DEBUG(misc, 0, "Invalid display value for newstype %s: %s", item->name, item->value);
continue;
}
}