From 186125ffb66964204c9b840c173f7ac5dca1a050 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 1 Nov 2003 22:11:33 +0000 Subject: fix potential crash svn-id: r11037 --- common/config-manager.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'common') 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"); } -- cgit v1.2.3