diff options
author | Max Horn | 2004-03-31 18:00:46 +0000 |
---|---|---|
committer | Max Horn | 2004-03-31 18:00:46 +0000 |
commit | b6a4610a778e100ed0186ef702bb880ccaab2dbc (patch) | |
tree | dfdec5ab50996645c2da18fa7894690c14ee7f4b /common | |
parent | 933aab310067499f96c6e5bc3fb64f1af081707e (diff) | |
download | scummvm-rg350-b6a4610a778e100ed0186ef702bb880ccaab2dbc.tar.gz scummvm-rg350-b6a4610a778e100ed0186ef702bb880ccaab2dbc.tar.bz2 scummvm-rg350-b6a4610a778e100ed0186ef702bb880ccaab2dbc.zip |
be tolerant against abuse of ConfMan.getInt(); add missing default value for 'speech_volume' in bs1
svn-id: r13435
Diffstat (limited to 'common')
-rw-r--r-- | common/config-manager.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/config-manager.cpp b/common/config-manager.cpp index cca805ec6b..8dec3ae4e0 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -334,6 +334,13 @@ const String & ConfigManager::get(const String &key, const String &domain) const int ConfigManager::getInt(const String &key, const String &dom) const { String value(get(key, dom)); char *errpos; + + // For now, be tolerant against missing config keys. Strictly spoken, it is + // a bug in the calling code to retrieve an int for a key which isn't even + // present... and a default value of 0 seems rather arbitrary. + if (value.isEmpty()) + return 0; + int ivalue = (int)strtol(value.c_str(), &errpos, 10); if (value.c_str() == errpos) error("Config file buggy: '%s' is not a valid integer", errpos); |