summaryrefslogtreecommitdiff
path: root/src/components/ble/AlertNotificationService.cpp
diff options
context:
space:
mode:
authorJF <JF002@users.noreply.github.com>2021-12-09 20:27:38 (GMT)
committerGitHub <noreply@github.com>2021-12-09 20:27:38 (GMT)
commitd29a9818af3b4ecb0c547f7ccd998eb55ca821c7 (patch)
tree572ece371e587fb6e5c3b531473a528305ba1809 /src/components/ble/AlertNotificationService.cpp
parentb946b8d156175309ab778038dab75ec7996c05bc (diff)
parente8c1302cd65dbd804d152227ae76aa786d6f0b60 (diff)
Merge pull request #353 from Avamander/patch-weather
WeatherService
Diffstat (limited to 'src/components/ble/AlertNotificationService.cpp')
-rw-r--r--src/components/ble/AlertNotificationService.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/components/ble/AlertNotificationService.cpp b/src/components/ble/AlertNotificationService.cpp
index f616cce..0481912 100644
--- a/src/components/ble/AlertNotificationService.cpp
+++ b/src/components/ble/AlertNotificationService.cpp
@@ -53,8 +53,9 @@ int AlertNotificationService::OnAlert(uint16_t conn_handle, uint16_t attr_handle
// Ignore notifications with empty message
const auto packetLen = OS_MBUF_PKTLEN(ctxt->om);
- if (packetLen <= headerSize)
+ if (packetLen <= headerSize) {
return 0;
+ }
size_t bufferSize = std::min(packetLen + stringTerminatorSize, maxBufferSize);
auto messageSize = std::min(maxMessageSize, (bufferSize - headerSize));