filesystemmodel: fix crash when file is removed
authorMichael Catanzaro <mcatanzaro@redhat.com>
Thu, 23 Feb 2023 15:20:03 +0000 (09:20 -0600)
committerMichael Catanzaro <mcatanzaro@redhat.com>
Thu, 23 Feb 2023 15:20:03 +0000 (09:20 -0600)
In 32247bc50e63b709ae738a95a2ec71345b5fad75 node_get_for_file() was
changed to return GTK_INVALID_LIST_POSITION rather than 0 when the file
is untracked. Most call sites were updated accordingly, but this one was
missed.

Fixes #5619

gtk/gtkfilesystemmodel.c

index c085022e1958787cf3bd73428e5dda43f5316de6..9f4a5fafa9310a87e7e2f2b0ed20b6ba9e64a052 100644 (file)
@@ -459,7 +459,7 @@ remove_file (GtkFileSystemModel *model,
   g_return_if_fail (G_IS_FILE (file));
 
   id = node_get_for_file (model, file);
-  if (id == 0)
+  if (id == GTK_INVALID_LIST_POSITION)
     return;
 
   node = get_node (model, id);