From 479655f5ccaf9189d9599c941c563fe5ae32578e Mon Sep 17 00:00:00 2001
From: Andre Miranda <andreldm@xfce.org>
Date: Thu, 23 May 2019 22:41:28 -0300
Subject: [PATCH] Fix crash on unmounted volume in tree pane right click (Bug
 #15452)

---
 thunar/thunar-tree-view.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/thunar/thunar-tree-view.c b/thunar/thunar-tree-view.c
index 9752138ae..ceb117b25 100644
--- a/thunar/thunar-tree-view.c
+++ b/thunar/thunar-tree-view.c
@@ -1360,7 +1360,11 @@ G_GNUC_END_IGNORE_DEPRECATIONS
       gtk_widget_show (item);
     }
 
-  if (G_UNLIKELY (thunar_g_file_is_trash (thunar_file_get_file (file))))
+  if (G_UNLIKELY (file == NULL))
+    {
+      /* do nothing */
+    }
+  else if (G_UNLIKELY (thunar_g_file_is_trash (thunar_file_get_file (file))))
     {
       /* append the "Empty Trash" menu action */
       item = gtk_menu_item_new_with_mnemonic (_("_Empty Trash"));
@@ -1374,7 +1378,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
       gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
       gtk_widget_show (item);
     }
-  else if (G_LIKELY (file != NULL))
+  else
     {
       /* check if we have a non-trashed resource */
       if (G_LIKELY (!thunar_file_is_trashed (file)))
-- 
GitLab