aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorJohannes Schickel2010-06-15 17:34:26 +0000
committerJohannes Schickel2010-06-15 17:34:26 +0000
commit34d8196334c628ebf240c7e3fc86615bc371bdc0 (patch)
treea1b60aa32749723910004561f7b2c0f7ca0f710c /common
parentf607fc59dbdeecedb3151a7532be7e170812cb38 (diff)
downloadscummvm-rg350-34d8196334c628ebf240c7e3fc86615bc371bdc0.tar.gz
scummvm-rg350-34d8196334c628ebf240c7e3fc86615bc371bdc0.tar.bz2
scummvm-rg350-34d8196334c628ebf240c7e3fc86615bc371bdc0.zip
Output some warning in case an invalid ID was passed to TranslationManager::getLangById.
svn-id: r49873
Diffstat (limited to 'common')
-rw-r--r--common/translation.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/common/translation.cpp b/common/translation.cpp
index 5598cbcf8c..d29e7b5c72 100644
--- a/common/translation.cpp
+++ b/common/translation.cpp
@@ -196,8 +196,14 @@ const char *TranslationManager::getLangById(int id) {
case kTranslationBuiltinId:
return "C";
default:
- return po2c_getlang(id - 1);
+ if (id >= 0 && id - 1 < po2c_getnumlangs())
+ return po2c_getlang(id - 1);
}
+
+ // In case an invalid ID was specified, we will output a warning
+ // and return the same value as the auto detection id.
+ warning("Invalid language id %d passed to TranslationManager::getLangById", id);
+ return "";
}
#else // TRANSLATION