handle_dbus_gattcharacteristic_from_path: Ensure 'characteristic_uuid_str' is not NULL

pull/231/head
Olivier Martin 2021-09-15 22:35:10 +02:00 committed by Olivier Martin
parent c3abb7eb6c
commit fa54ae42cc
1 changed files with 5 additions and 0 deletions

View File

@ -35,6 +35,11 @@ static bool handle_dbus_gattcharacteristic_from_path(gattlib_context_t* conn_con
if (uuid != NULL) {
uuid_t characteristic_uuid;
const gchar *characteristic_uuid_str = org_bluez_gatt_characteristic1_get_uuid(characteristic);
if (characteristic_uuid_str == NULL) {
// It should not be expected to get NULL from GATT characteristic UUID but we still test it
fprintf(stderr, "Error: %s path unexpectly returns a NULL UUID.\n", object_path);
return false;
}
gattlib_string_to_uuid(characteristic_uuid_str, strlen(characteristic_uuid_str) + 1, &characteristic_uuid);