aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-07-15 22:59:19 +0200
committerChristian Schneppe <christian@pix-art.de>2018-07-15 22:59:19 +0200
commit9018eabd6d6477d8cf66d7cc9728c42607ff225c (patch)
tree8d5d5729c90775fe81b318e47a83f6b51e97b9fe /src/main/java/de
parent7927ee014cf76278cae1a833be64d21968d4439b (diff)
fall back to random subject langugae in case there is no english one
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/xml/Element.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/xml/Element.java b/src/main/java/de/pixart/messenger/xml/Element.java
index e9eaa1394..d7cace655 100644
--- a/src/main/java/de/pixart/messenger/xml/Element.java
+++ b/src/main/java/de/pixart/messenger/xml/Element.java
@@ -73,7 +73,7 @@ public class Element {
return findInternationalizedChildContent(name, Locale.getDefault().getLanguage());
}
- public String findInternationalizedChildContent(String name, @NonNull String language) {
+ private String findInternationalizedChildContent(String name, @NonNull String language) {
HashMap<String, String> contents = new HashMap<>();
for (Element child : this.children) {
if (name.equals(child.getName())) {
@@ -88,8 +88,11 @@ public class Element {
}
}
}
-
- return contents.get(null);
+ String value = contents.get(null);
+ if (value != null) {
+ return value;
+ }
+ return contents.size() > 0 ? contents.values().iterator().next() : null;
}
public Element findChild(String name, String xmlns) {