From a3e0959f771f776562ca77700871a3e4a75e571f Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sat, 15 Oct 2022 21:44:41 -0500 Subject: [PATCH] Don't ignore empty bodies A body that is present but has an empty string is not the same as no body. It may be useful for example for a message correction to an empty string. --- .../java/eu/siacs/conversations/xml/LocalizedContent.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/xml/LocalizedContent.java b/src/main/java/eu/siacs/conversations/xml/LocalizedContent.java index 57a2f3dba521a34cda29b0f4170e9d51a798cfc6..fac5099a70f8efed7c8c0b73bbefb6ffbf5d4638 100644 --- a/src/main/java/eu/siacs/conversations/xml/LocalizedContent.java +++ b/src/main/java/eu/siacs/conversations/xml/LocalizedContent.java @@ -29,8 +29,8 @@ public class LocalizedContent { final String childLanguage = child.getAttribute("xml:lang"); final String lang = childLanguage == null ? parentLanguage : childLanguage; final String content = child.getContent(); - if (content != null && (namespace == null || "jabber:client".equals(namespace))) { - if (contents.put(lang, content) != null) { + if (namespace == null || "jabber:client".equals(namespace)) { + if (contents.put(lang, content == null ? "" : content) != null) { //anything that has multiple contents for the same language is invalid return null; }