From bc42955a138795896f11b1c7c4b37170f25cf616 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 7 Mar 2023 20:54:31 -0500 Subject: [PATCH] filechooser: Handle pathless files g_file_get_path() can return NULL. Make our getter for file locations handle that case. Related: !5610 --- gtk/gtkfilechooserwidget.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 0c29b31076..9f084a6e77 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -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);