From fdc89f1a20889c0295534f58dc2e82ce8c55a18b Mon Sep 17 00:00:00 2001 From: Max Friedrich Date: Mon, 26 Dec 2022 23:34:29 +0100 Subject: [PATCH] Update src/systemtask/SystemTask.cpp Co-authored-by: JF --- src/systemtask/SystemTask.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 2f5fd214..687c90a5 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -426,10 +426,10 @@ void SystemTask::Work() { break; case Messages::LowBattery: { Pinetime::Controllers::NotificationManager::Notification notif; - std::array message { - "Low Battery\0Charge your watch to prevent data loss.\0"}; - notif.message = std::move(message); - notif.size = 53; + constexpr char message[] = "Low Battery\0Charge your watch to prevent data loss.\0"; + constexpr size_t messageSize = std::min(sizeof(message), Pinetime::Controllers::NotificationManager::MaximumMessageSize()); + std::memcpy(notif.message.data(), message, messageSize); + notif.size = messageSize; notif.category = Pinetime::Controllers::NotificationManager::Categories::SimpleAlert; notificationManager.Push(std::move(notif)); PushMessage(Messages::OnNewNotification);