diff options
author | Christian Schneppe <christian.schneppe@pix-art.de> | 2019-10-02 15:37:37 +0200 |
---|---|---|
committer | Christian Schneppe <christian.schneppe@pix-art.de> | 2019-10-02 15:38:16 +0200 |
commit | 616eba9d1fea7f9a72fae592402e12b188e64b73 (patch) | |
tree | d5cc49456ca9be2550547172e2740798d6135fb6 /src/main/java/de/pixart | |
parent | 60ca56c188c179f6ed34270e62c2fe2853142e32 (diff) |
fix NPE when using channel search and DOMAIN_LOCK
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ChannelDiscoveryActivity.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ChannelDiscoveryActivity.java b/src/main/java/de/pixart/messenger/ui/ChannelDiscoveryActivity.java index 175dd9bb8..a952bc85a 100644 --- a/src/main/java/de/pixart/messenger/ui/ChannelDiscoveryActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ChannelDiscoveryActivity.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.List; import java.util.concurrent.atomic.AtomicReference; +import de.pixart.messenger.Config; import de.pixart.messenger.R; import de.pixart.messenger.databinding.ActivityChannelDiscoveryBinding; import de.pixart.messenger.entities.Account; @@ -212,18 +213,19 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O return false; } - public void joinChannelSearchResult(String accountJid, MuclumbusService.Room result) { - final boolean syncAutojoin = getBooleanPreference("autojoin", R.bool.autojoin); - Account account = xmppConnectionService.findAccountByJid(Jid.of(accountJid)); + public void joinChannelSearchResult(String selectedAccount, MuclumbusService.Room result) { + final Jid jid = Config.DOMAIN_LOCK == null ? Jid.of(selectedAccount) : Jid.of(selectedAccount, Config.DOMAIN_LOCK, null); + final boolean syncAutoJoin = getBooleanPreference("autojoin", R.bool.autojoin); + final Account account = xmppConnectionService.findAccountByJid(jid); final Conversation conversation = xmppConnectionService.findOrCreateConversation(account, result.getRoom(), true, true, true); if (conversation.getBookmark() != null) { - if (!conversation.getBookmark().autojoin() && syncAutojoin) { + if (!conversation.getBookmark().autojoin() && syncAutoJoin) { conversation.getBookmark().setAutojoin(true); xmppConnectionService.pushBookmarks(account); } } else { final Bookmark bookmark = new Bookmark(account, conversation.getJid().asBareJid()); - bookmark.setAutojoin(syncAutojoin); + bookmark.setAutojoin(syncAutoJoin); account.getBookmarks().add(bookmark); xmppConnectionService.pushBookmarks(account); } |