stringsorter: Handle NULL strings
authorBenjamin Otte <otte@redhat.com>
Sat, 27 May 2023 17:05:32 +0000 (19:05 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 5 Jun 2023 12:12:54 +0000 (08:12 -0400)
NULL is a valid string GValue, so we need to handle it.
The utf8 normalizing and collating functions do not, so we better catch
it early.

gtk/gtkstringsorter.c

index ed2a0ac34ca5f4abb03714d6a6f6925f2c36edac..70739509e28cd2c18fee230ab7c5e09f1e21485a 100644 (file)
@@ -77,6 +77,11 @@ gtk_string_sorter_get_key (GtkExpression *expression,
     return NULL;
 
   string = g_value_get_string (&value);
+  if (string == NULL)
+    {
+      g_value_unset (&value);
+      return NULL;
+    }
 
   if (ignore_case)
     s = g_utf8_casefold (string, -1);