From: Ricardo Cruz Date: Mon, 12 Jul 2004 22:03:18 +0000 (+0000) Subject: Damn strlen() crashes when NULL is passed. Fixed. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=a46fd0c612067749e2028879ac8689c0744f7683;p=supertux.git Damn strlen() crashes when NULL is passed. Fixed. SVN-Revision: 1568 --- diff --git a/src/lispreader.cpp b/src/lispreader.cpp index 839ceeff6..e9a150d0d 100644 --- a/src/lispreader.cpp +++ b/src/lispreader.cpp @@ -1218,7 +1218,7 @@ LispReader::read_string (const char* name, std::string& str, bool translatable) (text-fr "Bonjour Monde!") being fr the value of LANG (echo $LANG) for the language we want to translate to */ - char* lang = getenv("LANG"); + char* lang = getenv("tt"); char str_[1024]; // check, for instance, for (title-fr_FR "Bonjour") sprintf(str_, "%s-%s", name, lang); @@ -1227,7 +1227,7 @@ LispReader::read_string (const char* name, std::string& str, bool translatable) if(!obj) // check, for instance, for (title-fr "Bonjour") { - if(strlen(lang) >= 2) + if(lang != NULL && strlen(lang) >= 2) { char lang_[3]; strncpy(lang_, lang, 2);