Make foreach_vocs_service() safe for passing NULL pointers. Found with the SVACE static analysis tool. --- src/shared/vcp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shared/vcp.c b/src/shared/vcp.c index b7e17e448..06264a241 100644 --- a/src/shared/vcp.c +++ b/src/shared/vcp.c @@ -2701,6 +2701,9 @@ static void foreach_vocs_service(struct gatt_db_attribute *attr, struct bt_vcp *vcp = user_data; struct bt_vocs *vocs = vcp_get_vocs(vcp); + if (!vocs || !attr) + return; + vocs->service = attr; gatt_db_service_set_claimed(attr, true); -- 2.34.1