aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorMax Horn2003-10-09 11:15:54 +0000
committerMax Horn2003-10-09 11:15:54 +0000
commit02b132b31c78fac0afc8b9eff266d42223097cd3 (patch)
tree63f7d51a188e4ee6c3f9f07713b38f87462dcd0b /base
parent91aaef03bc57bdf1284c3404b96b983d03695194 (diff)
downloadscummvm-rg350-02b132b31c78fac0afc8b9eff266d42223097cd3.tar.gz
scummvm-rg350-02b132b31c78fac0afc8b9eff266d42223097cd3.tar.bz2
scummvm-rg350-02b132b31c78fac0afc8b9eff266d42223097cd3.zip
make khaleks correct fix a bit nicer; and add similar safety nets to the other parser...() methods
svn-id: r10696
Diffstat (limited to 'base')
-rw-r--r--base/gameDetector.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp
index 6e7732299d..6455e353aa 100644
--- a/base/gameDetector.cpp
+++ b/base/gameDetector.cpp
@@ -500,6 +500,9 @@ void GameDetector::setGame(const String &name) {
}
int GameDetector::parseGraphicsMode(const String &str) {
+ if (str.isEmpty())
+ return -1;
+
const char *s = str.c_str();
const GraphicsMode *gm = gfx_modes;
while (gm->name) {
@@ -513,6 +516,9 @@ int GameDetector::parseGraphicsMode(const String &str) {
}
Language GameDetector::parseLanguage(const String &str) {
+ if (str.isEmpty())
+ return UNK_LANG;
+
const char *s = str.c_str();
const LanguageDescription *l = languages;
while (l->name) {
@@ -525,6 +531,9 @@ Language GameDetector::parseLanguage(const String &str) {
}
Platform GameDetector::parsePlatform(const String &str) {
+ if (str.isEmpty())
+ return kPlatformUnknown;
+
const char *s = str.c_str();
if (!scumm_stricmp(s, "pc"))
return kPlatformPC;
@@ -539,7 +548,7 @@ Platform GameDetector::parsePlatform(const String &str) {
}
int GameDetector::parseMusicDriver(const String &str) {
- if (str == String::emptyString)
+ if (str.isEmpty())
return -1;
const char *s = str.c_str();