revert reply fallback handling fix

This commit is contained in:
kosyak 2024-05-22 09:56:57 +02:00
parent ead327d30a
commit 350b36a2d6

View file

@ -880,18 +880,14 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable
return sb;
}
if (replyMessage != null && replyMessage.edits.isEmpty()) {
sb.replace(0, replyMessage.body.codePointCount(0, replyMessage.body.length()) + 3, "");
} else {
Element bodyFallback = replyFallback.get(0).findChild("body");
int startCodePoint = Integer.parseInt(bodyFallback.getAttribute("start"));
int endCodePoint = Integer.parseInt(bodyFallback.getAttribute("end"));
Element bodyFallback = replyFallback.get(0).findChild("body");
int startCodePoint = Integer.parseInt(bodyFallback.getAttribute("start"));
int endCodePoint = Integer.parseInt(bodyFallback.getAttribute("end"));
if (startCodePoint < 0) return sb;
if (endCodePoint > sb.length()) return sb;
if (startCodePoint < 0) return sb;
if (endCodePoint > sb.length()) return sb;
sb.replace(message.body.offsetByCodePoints(0, startCodePoint), message.body.offsetByCodePoints(0, endCodePoint), "");
}
sb.replace(message.body.offsetByCodePoints(0, startCodePoint), message.body.offsetByCodePoints(0, endCodePoint), "");
return sb;
}