Skip to content

Commit aab4d2d

Browse files
committed
AlertNotificationClient: don't dereference a null characteristic
Every branch above guards against characteristic being null, the final else did not. Only reachable in a debug build, since the dereference is inside NRF_LOG_INFO.
1 parent 3c38bb6 commit aab4d2d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/components/ble/AlertNotificationClient.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ int AlertNotificationClient::OnCharacteristicsDiscoveryEvent(uint16_t connection
101101
} else if (characteristic != nullptr && ble_uuid_cmp(&controlPointUuid.u, &characteristic->uuid.u) == 0) {
102102
NRF_LOG_INFO("ANS Characteristic discovered : controlPointUuid");
103103
controlPointHandle = characteristic->val_handle;
104-
} else
104+
} else if (characteristic != nullptr) {
105105
NRF_LOG_INFO("ANS Characteristic discovered : 0x%x", characteristic->val_handle);
106+
}
106107
}
107108
return 0;
108109
}

0 commit comments

Comments
 (0)