From 6d7ae99c940343d5256cbe0acd3293686d2dfbb0 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Wed, 20 Sep 2023 16:16:40 +0200 Subject: [PATCH] Don't crash when editing pending message --- src/neochatroom.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/neochatroom.cpp b/src/neochatroom.cpp index ae785f92b..bab0df880 100644 --- a/src/neochatroom.cpp +++ b/src/neochatroom.cpp @@ -1488,8 +1488,11 @@ QString NeoChatRoom::chatBoxEditMessage() const EventHandler eventhandler; eventhandler.setRoom(this); - eventhandler.setEvent(&**findInTimeline(m_chatBoxEditId)); - return eventhandler.getPlainBody(); + if (auto event = findInTimeline(m_chatBoxEditId); event != historyEdge()) { + eventhandler.setEvent(&**event); + return eventhandler.getPlainBody(); + } + return {}; } QString NeoChatRoom::chatBoxAttachmentPath() const