From ead327d30ad628555f5822802c02dc4a43eb4455 Mon Sep 17 00:00:00 2001 From: kosyak Date: Tue, 21 May 2024 21:26:36 +0200 Subject: [PATCH] fix replies without callback handling --- .../java/eu/siacs/conversations/entities/Message.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index 90eee7026..9b4be3e0d 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -875,14 +875,14 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable private StringBuilder removeReplyFallback(Message message, Message replyMessage) { StringBuilder sb = new StringBuilder(message.body); + List replyFallback = message.getFallbacks("urn:xmpp:reply:0"); + if (replyFallback.isEmpty()) { + return sb; + } + if (replyMessage != null && replyMessage.edits.isEmpty()) { sb.replace(0, replyMessage.body.codePointCount(0, replyMessage.body.length()) + 3, ""); } else { - List replyFallback = message.getFallbacks("urn:xmpp:reply:0"); - if (replyFallback.isEmpty()) { - return sb; - } - Element bodyFallback = replyFallback.get(0).findChild("body"); int startCodePoint = Integer.parseInt(bodyFallback.getAttribute("start")); int endCodePoint = Integer.parseInt(bodyFallback.getAttribute("end"));