fix NULL check for getenv("LANGUAGE")
authorXiao Xiangquan <xiaoxiangquan@gmail.com>
Fri, 16 Sep 2011 08:32:46 +0000 (08:32 +0000)
committerXiao Xiangquan <xiaoxiangquan@gmail.com>
Fri, 16 Sep 2011 08:32:46 +0000 (08:32 +0000)
source/blender/blenfont/intern/blf_lang.c

index 3547e5095e2a52bd820af0c57c5476f04f827ba0..581a936ee87a0390a76ecaad58c16215a9a45a93 100644 (file)
@@ -150,9 +150,10 @@ void BLF_lang_set(const char *str)
        {
                const char *locale;
                static char default_locale[64]="\0";
+               static char *env_language = getenv("LANGUAGE");
 
-               if(default_locale[0]==0) /* store defaul locale */
-                       strncpy(default_locale, getenv("LANGUAGE"), sizeof(default_locale));
+               if(default_locale[0]==0 && env_language!=NULL) /* store defaul locale */
+                       strncpy(default_locale, env_language, sizeof(default_locale));
 
                if(short_locale[0])
                        locale= short_locale;