[Scummvm-cvs-logs] CVS: scummvm/common config-manager.cpp,1.21,1.22

Max Horn fingolfin at users.sourceforge.net
Wed Mar 31 10:13:04 CEST 2004


Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29706/common

Modified Files:
	config-manager.cpp 
Log Message:
be tolerant against abuse of ConfMan.getInt(); add missing default value for 'speech_volume' in bs1

Index: config-manager.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/config-manager.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- config-manager.cpp	29 Mar 2004 19:15:23 -0000	1.21
+++ config-manager.cpp	31 Mar 2004 18:00:46 -0000	1.22
@@ -334,6 +334,13 @@
 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);





More information about the Scummvm-git-logs mailing list