Protect against strcmp() on NULL strings
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 28 Nov 2012 15:25:43 +0000 (16:25 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 28 Nov 2012 15:25:43 +0000 (16:25 +0100)
glib/ggettext.c

index ed7137e..79abf0c 100644 (file)
@@ -335,10 +335,11 @@ _g_dgettext_should_translate (void)
        *   - If locale is "C", maybe user calls setlocale(LC_ALL,"") later.
        *     Continue with old behavior of translating.
        */
-      if (0 != strcmp (default_domain, "messages") &&
+      if (!default_domain || !translator_comment || !translate_locale ||
+          (0 != strcmp (default_domain, "messages") &&
           '\0' == *translator_comment &&
           0 != strncmp (translate_locale, "en_", 3) &&
-          0 != strcmp (translate_locale, "C"))
+          0 != strcmp (translate_locale, "C")))
         should_translate = FALSE;
 
       g_once_init_leave (&translate,