fix NPE when using channel search and DOMAIN_LOCK closes #3458
This commit is contained in:
parent
f8bd4284a5
commit
37b87e18ee
|
@ -21,6 +21,7 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import eu.siacs.conversations.Config;
|
||||
import eu.siacs.conversations.R;
|
||||
import eu.siacs.conversations.databinding.ActivityChannelDiscoveryBinding;
|
||||
import eu.siacs.conversations.entities.Account;
|
||||
|
@ -217,18 +218,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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue