diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2015-04-28 13:31:33 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2015-04-28 13:31:33 +0200 |
commit | 51bf8ec98ea6b628ed38d03969492ef0fddd6c77 (patch) | |
tree | c8fb75ba4a5a6b46459e8d1f71e397aeec2fc630 /src/main/java | |
parent | b1843fb61a3f3c52ec99e3239a62d1976355f88c (diff) |
fixed npe when rotating screen in contact details activity
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index 40a4587c..f7156d7a 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -256,16 +256,19 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd MenuItem unblock = menu.findItem(R.id.action_unblock); MenuItem edit = menu.findItem(R.id.action_edit_contact); MenuItem delete = menu.findItem(R.id.action_delete_contact); + if (contact == null) { + return true; + } final XmppConnection connection = contact.getAccount().getXmppConnection(); if (connection != null && connection.getFeatures().blocking()) { if (this.contact.isBlocked()) { - menu.findItem(R.id.action_block).setVisible(false); + block.setVisible(false); } else { - menu.findItem(R.id.action_unblock).setVisible(false); + unblock.setVisible(false); } } else { - menu.findItem(R.id.action_unblock).setVisible(false); - menu.findItem(R.id.action_block).setVisible(false); + unblock.setVisible(false); + block.setVisible(false); } if (!contact.showInRoster()) { edit.setVisible(false); @@ -275,6 +278,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd } private void populateView() { + invalidateOptionsMenu(); setTitle(contact.getDisplayName()); if (contact.showInRoster()) { send.setVisibility(View.VISIBLE); |