stringsorter: Handle NULL strings
authorBenjamin Otte <otte@redhat.com>
Sat, 27 May 2023 17:05:32 +0000 (19:05 +0200)
committerBenjamin Otte <otte@redhat.com>
Mon, 5 Jun 2023 03:33:07 +0000 (05:33 +0200)
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 15866b930416cdfec45171cb0993711a97c02287..694e6318c513a8d891e2e325572a905cdba5fc95 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);