filechooser: Handle pathless files
authorMatthias Clasen <mclasen@redhat.com>
Wed, 8 Mar 2023 01:54:31 +0000 (20:54 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 8 Mar 2023 01:54:31 +0000 (20:54 -0500)
g_file_get_path() can return NULL. Make our
getter for file locations handle that case.

Related: !5610

gtk/gtkfilechooserwidget.c

index 0c29b31076227bef7309fe936404013cfc6cf464..9f084a6e77f8e2a023dfed3d3f4585ddc22af755 100644 (file)
@@ -2061,6 +2061,9 @@ file_chooser_get_location (GtkFileChooserWidget *impl,
   else
     location = g_file_get_path (dir_location);
 
+  if (!location)
+    location = g_strdup ("");
+
   g_clear_object (&dir_location);
   g_clear_object (&home_location);