[gtk/gtk-3-24: 1/2] gtkrecentfilter: handle g_content_type_from_mime_type() returning NULL



commit 8a53ed9e55dac8f559fa47f999e527640889659c
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Sun Jun 30 13:59:13 2019 +0200

    gtkrecentfilter: handle g_content_type_from_mime_type() returning NULL
    
    Otherwise we get errors on g_content_type_is_a(). This happens mostly on Windows
    because it only knows a limited set of mime types and tries to convert
    them to file extensions without any fallback.

 gtk/gtkrecentfilter.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkrecentfilter.c b/gtk/gtkrecentfilter.c
index 4062db59d9..70c021abda 100644
--- a/gtk/gtkrecentfilter.c
+++ b/gtk/gtkrecentfilter.c
@@ -746,11 +746,12 @@ gtk_recent_filter_filter (GtkRecentFilter           *filter,
           if (filter_info->mime_type != NULL)
             {
               gchar *filter_content_type, *rule_content_type;
-              gboolean match;
+              gboolean match = FALSE;
 
               filter_content_type = g_content_type_from_mime_type (filter_info->mime_type);
               rule_content_type = g_content_type_from_mime_type (rule->u.mime_type);
-              match = g_content_type_is_a (filter_content_type, rule_content_type);
+              if (filter_content_type != NULL && rule_content_type != NULL)
+                match = g_content_type_is_a (filter_content_type, rule_content_type);
               g_free (filter_content_type);
               g_free (rule_content_type);
 


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