From 71c84be4b45164dde505e17a25161f3c223efde1 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. --- 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 a0e07891a..74b82329b 100644 --- a/src/libneochat/neochatroom.cpp +++ b/src/libneochat/neochatroom.cpp @@ -1186,7 +1186,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();