dbus/on_interface_proxy_properties_changed: Check device_manager is not NULL (could happen on disconnection)

pull/266/head
Olivier Martin 2024-02-13 22:00:13 +01:00 committed by Olivier Martin
parent 959ee55b61
commit 9a9e49edcd
1 changed files with 9 additions and 1 deletions

View File

@ -173,6 +173,13 @@ on_interface_proxy_properties_changed (GDBusObjectManagerClient *device_manager,
const gchar *const *invalidated_properties,
gpointer user_data)
{
const char* proxy_object_path = g_dbus_proxy_get_object_path(interface_proxy);
struct gattlib_adapter* gattlib_adapter = user_data;
if (gattlib_adapter->device_manager == NULL) {
return;
}
// Count number of invalidated properties
size_t invalidated_properties_count = 0;
if (invalidated_properties != NULL) {
@ -183,7 +190,8 @@ on_interface_proxy_properties_changed (GDBusObjectManagerClient *device_manager,
}
}
GATTLIB_LOG(GATTLIB_DEBUG, "DBUS: on_interface_proxy_properties_changed: interface:%s changed_properties:%s invalidated_properties:%d",
GATTLIB_LOG(GATTLIB_DEBUG, "DBUS: on_interface_proxy_properties_changed(%s): interface:%s changed_properties:%s invalidated_properties:%d",
proxy_object_path,
g_dbus_proxy_get_interface_name(interface_proxy),
g_variant_print(changed_properties, TRUE),
invalidated_properties_count);