From b624a690a2f57e424f4e0bbad0227ca5eac1c86c Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 5 Sep 2022 17:46:16 +0200 Subject: [PATCH] daemon: Don't add unexported devices to the array Otherwise all the following devices will be ignored. --- src/up-daemon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/up-daemon.c b/src/up-daemon.c index 64de1cd..5bf9eaf 100644 --- a/src/up-daemon.c +++ b/src/up-daemon.c @@ -438,8 +438,11 @@ up_daemon_enumerate_devices (UpExportedDaemon *skeleton, object_paths = g_ptr_array_new_with_free_func (g_free); array = up_device_list_get_array (daemon->priv->power_devices); for (i = 0; i < array->len; i++) { + const char *object_path; device = (UpDevice *) g_ptr_array_index (array, i); - g_ptr_array_add (object_paths, g_strdup (up_device_get_object_path (device))); + object_path = up_device_get_object_path (device); + if (object_path != NULL) + g_ptr_array_add (object_paths, g_strdup (object_path)); } g_ptr_array_unref (array); g_ptr_array_add (object_paths, NULL);