From 48d65634a55b72cf5b5cc4324448bee56814999e Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Tue, 14 May 2019 13:35:49 +0200 Subject: [PATCH] Handling U+0000 explicitely to avoid collision with other cases Fix issue #135 --- glib/guniprop.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/glib/guniprop.c b/glib/guniprop.c index cd3675fbf..9a79e4316 100644 --- a/glib/guniprop.c +++ b/glib/guniprop.c @@ -623,13 +623,19 @@ gunichar g_unichar_totitle (gunichar c) { unsigned int i; + + /* We handle U+0000 explicitely because some elements in + * title_table[i][1] may be null. */ + if (c == 0) + return c; + for (i = 0; i < G_N_ELEMENTS (title_table); ++i) { if (title_table[i][0] == c || title_table[i][1] == c || title_table[i][2] == c) return title_table[i][0]; } - + if (TYPE (c) == G_UNICODE_LOWERCASE_LETTER) return g_unichar_toupper (c);