Fix NPEs in blocking code

This commit is contained in:
Sam Whited 2014-12-22 10:50:29 -05:00
parent a94663aaa4
commit e1cb72b9ef
2 changed files with 4 additions and 2 deletions

View file

@ -31,6 +31,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Blockable; import eu.siacs.conversations.entities.Blockable;
import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversation;
@ -316,7 +317,8 @@ public class ConversationActivity extends XmppActivity
} else { } else {
menuUnblock.setVisible(false); menuUnblock.setVisible(false);
} }
if (!this.getSelectedConversation().getAccount().getXmppConnection().getFeatures().blocking()) { final Account account = this.getSelectedConversation().getAccount();
if (account.getStatus() != Account.State.ONLINE || !account.getXmppConnection().getFeatures().blocking()) {
menuBlock.setVisible(false); menuBlock.setVisible(false);
menuUnblock.setVisible(false); menuUnblock.setVisible(false);
} }

View file

@ -327,7 +327,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
if (mAccount == null) { if (mAccount == null) {
showQrCode.setVisible(false); showQrCode.setVisible(false);
showBlocklist.setVisible(false); showBlocklist.setVisible(false);
} else if (!mAccount.getXmppConnection().getFeatures().blocking()) { } else if (mAccount.getStatus() != Account.State.ONLINE || !mAccount.getXmppConnection().getFeatures().blocking()) {
showBlocklist.setVisible(false); showBlocklist.setVisible(false);
} }
return true; return true;