summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2022-09-05 17:46:16 +0200
committerBastien Nocera <hadess@hadess.net>2022-09-05 17:47:08 +0200
commitb624a690a2f57e424f4e0bbad0227ca5eac1c86c (patch)
treeb16462e4aa8f69f384a47d24081e38e72ffeb95e /src
parentf035ab12a52c4035b971533c3f7655f3847f8f3c (diff)
daemon: Don't add unexported devices to the array
Otherwise all the following devices will be ignored.
Diffstat (limited to 'src')
-rw-r--r--src/up-daemon.c5
1 files changed, 4 insertions, 1 deletions
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);