diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-06-16 20:38:35 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-06-16 20:38:35 +0200 |
commit | f91d16cbe7aebc3fb0abc6827bcdbfb8fc8da437 (patch) | |
tree | 8ee2b7eec2237288830d8610a12ce863617adc47 /src | |
parent | b92b3863b9b4cd35a3248f488bb4e9ad77cc2adf (diff) |
don't fail on missing jid in bookmarks
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Bookmark.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Bookmark.java b/src/main/java/eu/siacs/conversations/entities/Bookmark.java index f5cfba3a..91e34116 100644 --- a/src/main/java/eu/siacs/conversations/entities/Bookmark.java +++ b/src/main/java/eu/siacs/conversations/entities/Bookmark.java @@ -56,7 +56,9 @@ public class Bookmark extends Element implements ListItem { && !getBookmarkName().trim().isEmpty()) { return getBookmarkName().trim(); } else { - return this.getJid().getLocalpart(); + Jid jid = this.getJid(); + String name = jid != null ? jid.getLocalpart() : getAttribute("jid"); + return name != null ? name : ""; } } @@ -66,7 +68,7 @@ public class Bookmark extends Element implements ListItem { if (jid != null) { return jid.toString(); } else { - return null; + return getAttribute("jid"); //fallback if jid wasn't parsable } } @@ -77,7 +79,7 @@ public class Bookmark extends Element implements ListItem { @Override public List<Tag> getTags(Context context) { - ArrayList<Tag> tags = new ArrayList<Tag>(); + ArrayList<Tag> tags = new ArrayList<>(); for (Element element : getChildren()) { if (element.getName().equals("group") && element.getContent() != null) { String group = element.getContent(); |