aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-11-01 22:11:33 +0000
committerMax Horn2003-11-01 22:11:33 +0000
commit186125ffb66964204c9b840c173f7ac5dca1a050 (patch)
treef16da8fa8768333f0ffda5ec9969a8e8b63ecc1e
parentadbaab7ef998608f19f6740658e4911f1ca16a73 (diff)
downloadscummvm-rg350-186125ffb66964204c9b840c173f7ac5dca1a050.tar.gz
scummvm-rg350-186125ffb66964204c9b840c173f7ac5dca1a050.tar.bz2
scummvm-rg350-186125ffb66964204c9b840c173f7ac5dca1a050.zip
fix potential crash
svn-id: r11037
-rw-r--r--common/config-manager.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/common/config-manager.cpp b/common/config-manager.cpp
index 8e6bd06504..49f221a17e 100644
--- a/common/config-manager.cpp
+++ b/common/config-manager.cpp
@@ -282,15 +282,17 @@ int ConfigManager::getInt(const String &key, const String &dom) const {
String value(get(key, dom));
// Convert the string to an integer.
// TODO: We should perform some error checking.
- long v = strtol(value.c_str(), 0, 10);
- return (int)v;
+ if (value.c_str())
+ return (int)strtol(value.c_str(), 0, 10);
+ else
+ return 0;
}
bool ConfigManager::getBool(const String &key, const String &dom) const {
String value(get(key, dom));
// '1', 'true' and 'yes' are accepted as true values; everything else
// maps to value 'false'.
- return (value == "true") || (value == "yes") || (value == "1");
+ return (value == trueStr) || (value == "yes") || (value == "1");
}