summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Berla <corey@berla.me>2022-07-17 23:17:03 -0700
committerAntónio Fernandes <antoniof@gnome.org>2023-01-10 02:01:27 +0000
commit4c525f91f76896bde48b5e02c8b9446033d621b5 (patch)
treef2561d12d39f1caab77f956c95085995a8bb6e40
parent45cd63d22ae8c4fd360cb3bb43620088a5f659c4 (diff)
downloadnautilus-4c525f91f76896bde48b5e02c8b9446033d621b5.tar.gz
list-view: Check if self is NULL before getting listbase
If the view is no longer available i.e. switched to the GridView, this crashes. Simply move the call to nautilus_list_base_get_model() after the NULL check.
-rw-r--r--src/nautilus-list-view.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 47169b575..380258396 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -901,11 +901,13 @@ unload_file_timeout (gpointer data)
{
g_autoptr (UnloadDelayData) unload_data = data;
NautilusListView *self = unload_data->self;
- NautilusViewModel *model = nautilus_list_base_get_model (NAUTILUS_LIST_BASE (self));
+ NautilusViewModel *model;
+
if (unload_data->self == NULL)
{
return G_SOURCE_REMOVE;
}
+ model = nautilus_list_base_get_model (NAUTILUS_LIST_BASE (self));
for (guint i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (model)); i++)
{