glib: fix locale detection on android
authorLionel Landwerlin <llandwerlin@gmail.com>
Fri, 27 Jul 2012 12:52:17 +0000 (14:52 +0200)
committerLionel Landwerlin <llandwerlin@gmail.com>
Fri, 27 Jul 2012 17:41:05 +0000 (19:41 +0200)
g_utf8_strup() tries to call setlocale() before starting to compute
the length of its first argument. Calling setlocale() can return NULL
(as specified in the man page), and obviously that happens on android.

https://bugzilla.gnome.org/show_bug.cgi?id=680704

glib/guniprop.c

index 420d58a..c56f8d7 100644 (file)
@@ -753,6 +753,9 @@ get_locale_type (void)
   g_free (tem);
 #else
   const char *locale = setlocale (LC_CTYPE, NULL);
+
+  if (locale == NULL)
+    return LOCALE_NORMAL;
 #endif
 
   switch (locale[0])