fix NPE during bookmark creation

closes #4312

fixes #4211

thank you @singpolyma
This commit is contained in:
Daniel Gultsch 2022-04-21 17:01:06 +02:00
parent e3cae4cb1d
commit d7637192e2

View file

@ -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()) {