1
0
mirror of https://github.com/anope/anope.git synced 2026-07-07 06:53:13 +02:00

BUILD : 1.7.13 (974) BUGS : 454 NOTES : Fixed a crash when passing a NULL-user to moduleGetLangString

git-svn-id: svn://svn.anope.org/anope/trunk@974 31f1291d-b8d6-0310-a050-a5561fc1590b


git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@699 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b
2006-03-01 09:43:27 +00:00
parent 910a99d284
commit a249b69fa9
3 changed files with 11 additions and 4 deletions
+5 -3
View File
@@ -2564,7 +2564,7 @@ char *moduleGetLangString(User * u, int number)
mod_current_module = findModule(mod_current_module_name);
/* Find the users lang, and use it if we can */
if (u->na && u->na->nc)
if (u && u->na && u->na->nc)
lang = u->na->nc->language;
/* If the users lang isnt supported, drop back to English */
@@ -2572,14 +2572,16 @@ char *moduleGetLangString(User * u, int number)
lang = LANG_EN_US;
/* If the requested lang string exists for the language */
if (mod_current_module->lang[lang].argc > number)
if (mod_current_module->lang[lang].argc > number) {
return mod_current_module->lang[lang].argv[number];
/* Return an empty string otherwise, because we might be used without
* the return value being checked. If we would return NULL, bad things
* would happen!
*/
else
} else {
alog("%s: INVALID language string call, language: [%d], String [%d]", mod_current_module->name, lang, number);
return "";
}
}
/**