From b68561900c6f69e7393263c0032b38a858da7885 Mon Sep 17 00:00:00 2001
From: Alexander Schwinn <alexxcons@xfce.org>
Date: Fri, 29 Mar 2024 11:53:34 +0100
Subject: [PATCH] Fix possible NULL pointer dereference (#1330)

---
 thunar/thunar-tree-view-model.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/thunar/thunar-tree-view-model.c b/thunar/thunar-tree-view-model.c
index 1d511f0f9..6187c321d 100644
--- a/thunar/thunar-tree-view-model.c
+++ b/thunar/thunar-tree-view-model.c
@@ -1486,7 +1486,7 @@ thunar_tree_view_model_iter_nth_child (GtkTreeModel *model,
   else
     node = g_sequence_get (parent->user_data);
 
-  if (n >= node->n_children)
+  if (node == NULL || n >= node->n_children)
     return FALSE;
 
   ptr = g_sequence_get_iter_at_pos (node->children, n);
-- 
GitLab