From 25e1e11c811efa1c1809992f5fe7e3af9e44f7c3 Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Tue, 16 May 2023 08:14:39 -0500 Subject: [PATCH] file-backend: avoid critical when cancellable is unset In 0e205fce5fbfa8f2c6f6ac0acc890311ff333d04 I improperly assumed that the cancellable would always be valid. Avoid criticals when it is NULL. --- libsecret/secret-file-backend.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libsecret/secret-file-backend.c b/libsecret/secret-file-backend.c index dd18a5b..825851b 100644 --- a/libsecret/secret-file-backend.c +++ b/libsecret/secret-file-backend.c @@ -581,7 +581,8 @@ secret_file_backend_real_init_async (GAsyncInitable *initable, init = g_new0 (InitClosure, 1); init->io_priority = io_priority; init->file = file; - init->cancellable = g_object_ref (cancellable); + if (cancellable) + init->cancellable = g_object_ref (cancellable); g_task_set_task_data (task, init, init_closure_free); g_bus_get (G_BUS_TYPE_SESSION, cancellable, on_bus_get, task); } else {