dragicon: Handle files without info
authorMatthias Clasen <mclasen@redhat.com>
Mon, 30 Jan 2023 18:26:37 +0000 (13:26 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 30 Jan 2023 19:03:13 +0000 (14:03 -0500)
g_file_query_info can (and does) fail,
occasionally. Handle it.

gtk/gtkdragicon.c

index 67d2b4b0d10a6d144e98c0cf956d69ad52242221..3d684ecfbc0184c898c77fb97e342451a3f3941c 100644 (file)
@@ -555,6 +555,9 @@ gtk_drag_icon_create_widget_for_value (const GValue *value)
       GtkWidget *image;
 
       info = g_file_query_info (G_FILE (g_value_get_object (value)), "standard::icon", 0, NULL, NULL);
+      if (!info)
+        return NULL;
+
       image = gtk_image_new_from_gicon (g_file_info_get_icon (info));
       gtk_widget_add_css_class (image, "large-icons");
       g_object_unref (info);