From d7637192e2254392cc0870c63a0a4d4515720e61 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 21 Apr 2022 17:01:06 +0200 Subject: [PATCH] fix NPE during bookmark creation closes #4312 fixes #4211 thank you @singpolyma --- .../siacs/conversations/services/XmppConnectionService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 42b699e46..0f121b0b3 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1793,7 +1793,9 @@ public class XmppConnectionService extends Service { public void createBookmark(final Account account, final Bookmark bookmark) { account.putBookmark(bookmark); final XmppConnection connection = account.getXmppConnection(); - if (connection.getFeatures().bookmarks2()) { + if (connection == null) { + Log.d(Config.LOGTAG, account.getJid().asBareJid()+": no connection. ignoring bookmark creation"); + } else if (connection.getFeatures().bookmarks2()) { final Element item = mIqGenerator.publishBookmarkItem(bookmark); pushNodeAndEnforcePublishOptions(account, Namespace.BOOKMARKS2, item, bookmark.getJid().asBareJid().toEscapedString(), PublishOptions.persistentWhitelistAccessMaxItems()); } else if (connection.getFeatures().bookmarksConversion()) {