summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2023-01-11 14:00:34 +0100
committerAntónio Fernandes <antoniof@gnome.org>2023-03-05 00:03:43 +0000
commit5aeb898869fc7a3d4107802dc5b95bee6f50cb13 (patch)
tree5056dd2cbc6a1b05060a6d692e59f87a898a974d
parent765b4d24c3eab79e5356d5bf0023ffd00f6ccce6 (diff)
downloadnautilus-5aeb898869fc7a3d4107802dc5b95bee6f50cb13.tar.gz
directory: Prevent usage of uninitialized hash table
I see regularly the following debug print on Nautilus startup: `GLib-CRITICAL **: 10:52:52.992: g_hash_table_foreach: assertion 'hash_table != NULL' failed`. This is because the `emit_change_signals_for_all_files_in_all_directories` function is called before the `directories` hash table is initialzed. Let's return early to prevent usage of the uninitialized hash table.
-rw-r--r--src/nautilus-directory.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nautilus-directory.c b/src/nautilus-directory.c
index 611afb6ef..aa6a89809 100644
--- a/src/nautilus-directory.c
+++ b/src/nautilus-directory.c
@@ -434,6 +434,11 @@ emit_change_signals_for_all_files_in_all_directories (void)
GList *dirs, *l;
NautilusDirectory *directory;
+ if (directories == NULL)
+ {
+ return;
+ }
+
dirs = NULL;
g_hash_table_foreach (directories,
collect_all_directories,