[Scummvm-cvs-logs] SF.net SVN: scummvm:[49873] scummvm/trunk/common/translation.cpp
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Tue Jun 15 19:34:26 CEST 2010
Revision: 49873
http://scummvm.svn.sourceforge.net/scummvm/?rev=49873&view=rev
Author: lordhoto
Date: 2010-06-15 17:34:26 +0000 (Tue, 15 Jun 2010)
Log Message:
-----------
Output some warning in case an invalid ID was passed to TranslationManager::getLangById.
Modified Paths:
--------------
scummvm/trunk/common/translation.cpp
Modified: scummvm/trunk/common/translation.cpp
===================================================================
--- scummvm/trunk/common/translation.cpp 2010-06-15 17:34:07 UTC (rev 49872)
+++ scummvm/trunk/common/translation.cpp 2010-06-15 17:34:26 UTC (rev 49873)
@@ -196,8 +196,14 @@
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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list