[gtk/wip/hadess/fix-remote-filechooser-main: 1/2] filechooser: Fix crash when file has no content-type



commit 823714cf66c887886fb58a21c016f0d58acb1047
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Feb 28 16:56:29 2020 +0100

    filechooser: Fix crash when file has no content-type
    
    This might happen for slow filesystems where a fast-content-type might
    be provided instead. Don't try to manipulate that content_type if it's
    NULL, otherwise we'll either throw warnings (at best) or crash (at
    worse).
    
    Conflicts:
            gtk/gtkfilechooserwidget.c

 gtk/gtkfilechooserwidget.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 9460663468..adee2ab5d8 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -4599,6 +4599,9 @@ get_type_information (GtkFileChooserWidget *impl,
 
   GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
   content_type = g_file_info_get_content_type (info);
+  if (!content_type)
+    goto end;
+
   switch (priv->type_format)
     {
     case TYPE_FORMAT_MIME:
@@ -4616,6 +4619,7 @@ get_type_information (GtkFileChooserWidget *impl,
       g_assert_not_reached ();
     }
 
+end:
   return g_strdup ("");
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]