From 4db03acf3e49fe6493d47c2ae18974aaec863e2d Mon Sep 17 00:00:00 2001 From: Phillip Davis Date: Fri, 10 Apr 2026 14:04:15 -0400 Subject: [PATCH] fix NPE from reading UI thread data `onTextDeleted` is called from a single-threaded executor. the zero-arg overload of `storeNextMessage` reads from the `EditMessage` component, but `onTextDeleted` should obviously never read a non-null message, so there's no reason to coordinate it with the UI thread. --- .../conversations/ui/ConversationFragment.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 2ba54997b3fa822eaa8cad09a5a358d35119d9d2..320e7aad33ca625f3f9d3741130c33114af1284d 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -4641,16 +4641,14 @@ public class ConversationFragment extends XmppFragment && conversation.setOutgoingChatState(Config.DEFAULT_CHAT_STATE)) { service.sendChatState(conversation); } - if (storeNextMessage()) { - runOnUiThread( - () -> { - if (activity == null) { - return; - } + final boolean stored = storeNextMessage(null); + runOnUiThread( + () -> { + if (stored && activity != null) { activity.onConversationsListItemUpdated(); - }); - } - runOnUiThread(this::updateSendButton); + } + updateSendButton(); + }); } @Override