From bc6e22bc6d9699a193a0e31e5efd37259003eb81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Veres=20K=C3=A1roly?= Date: Sat, 10 Jan 2026 02:26:39 +0100 Subject: [PATCH] Null check decoded messages in `loadPinnedMessage` `decryptMessage` returns null if it fails to decode the passed message. This value then got fed into `EventHandler::richBody` which logged a warning and cleared `m_pinnedMessage`. If we instead retain the value as an `EncryptedEvent`, the UI will pin the encrypted event placeholder instead of hiding the existence of pins. (cherry picked from commit 71c84be4b45164dde505e17a25161f3c223efde1) --- src/libneochat/neochatroom.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libneochat/neochatroom.cpp b/src/libneochat/neochatroom.cpp index 1cc6735fb..eeca86768 100644 --- a/src/libneochat/neochatroom.cpp +++ b/src/libneochat/neochatroom.cpp @@ -1181,7 +1181,10 @@ void NeoChatRoom::loadPinnedMessage() connection()->callApi(id(), mostRecentEventId).then([this](const auto &job) { auto event = fromJson>(job->jsonData()); if (auto encEv = eventCast(event.get())) { - event = decryptMessage(*encEv); + auto decryptedMessage = decryptMessage(*encEv); + if (decryptedMessage) { + event = std::move(decryptedMessage); + } } m_pinnedMessage = EventHandler::richBody(this, event.get()); Q_EMIT pinnedMessageChanged();