[Scummvm-cvs-logs] CVS: scummvm/common config-manager.cpp,1.3,1.4
Max Horn
fingolfin at users.sourceforge.net
Sat Nov 1 14:13:01 CET 2003
Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1:/tmp/cvs-serv6117/common
Modified Files:
config-manager.cpp
Log Message:
fix potential crash
Index: config-manager.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/config-manager.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- config-manager.cpp 10 Oct 2003 11:13:25 -0000 1.3
+++ config-manager.cpp 1 Nov 2003 22:11:33 -0000 1.4
@@ -282,15 +282,17 @@
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");
}
More information about the Scummvm-git-logs
mailing list