diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-06-16 20:38:35 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-06-19 20:12:31 +0200 |
commit | 1906ccb420a099b66c998a54e00cbf59f8c882f8 (patch) | |
tree | 8a7737e9e8247d572c904830a284f81a0ab687b7 | |
parent | 18153467a0e45f9ef8e98dddb94df768915d6e1a (diff) |
don't fail on missing jid in bookmarks
-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 3f3707d01..e6aeadf4a 100644 --- a/src/main/java/eu/siacs/conversations/entities/Bookmark.java +++ b/src/main/java/eu/siacs/conversations/entities/Bookmark.java @@ -55,7 +55,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 : ""; } } @@ -65,7 +67,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 } } @@ -76,7 +78,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(); |