diff options
Diffstat (limited to 'src/components/ble/AlertNotificationService.cpp')
| -rw-r--r-- | src/components/ble/AlertNotificationService.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/components/ble/AlertNotificationService.cpp b/src/components/ble/AlertNotificationService.cpp index c3187c1..d91e209 100644 --- a/src/components/ble/AlertNotificationService.cpp +++ b/src/components/ble/AlertNotificationService.cpp @@ -66,8 +66,11 @@ int AlertNotificationService::OnAlert(uint16_t conn_handle, uint16_t attr_handle const auto maxMessageSize {NotificationManager::MaximumMessageSize()}; const auto maxBufferSize{maxMessageSize + headerSize}; - const auto dbgPacketLen = OS_MBUF_PKTLEN(ctxt->om); - size_t bufferSize = std::min(dbgPacketLen + stringTerminatorSize, maxBufferSize); + // Ignore notifications with empty message + const auto packetLen = OS_MBUF_PKTLEN(ctxt->om); + if(packetLen <= headerSize) return 0; + + size_t bufferSize = std::min(packetLen + stringTerminatorSize, maxBufferSize); auto messageSize = std::min(maxMessageSize, (bufferSize-headerSize)); Categories category; |
