diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index 3ad4156577a..6a8e6c003b1 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -2587,10 +2587,11 @@ int bt_gatt_discover(struct bt_conn *conn, return gatt_read_type(conn, params); case BT_GATT_DISCOVER_DESCRIPTOR: /* Only descriptors can be filtered */ - if (!bt_uuid_cmp(params->uuid, BT_UUID_GATT_PRIMARY) || - !bt_uuid_cmp(params->uuid, BT_UUID_GATT_SECONDARY) || - !bt_uuid_cmp(params->uuid, BT_UUID_GATT_INCLUDE) || - !bt_uuid_cmp(params->uuid, BT_UUID_GATT_CHRC)) { + if (params->uuid && + (!bt_uuid_cmp(params->uuid, BT_UUID_GATT_PRIMARY) || + !bt_uuid_cmp(params->uuid, BT_UUID_GATT_SECONDARY) || + !bt_uuid_cmp(params->uuid, BT_UUID_GATT_INCLUDE) || + !bt_uuid_cmp(params->uuid, BT_UUID_GATT_CHRC))) { return -EINVAL; } /* Fallthrough. */