From 168ad50ddd6360f3280045a7cd92230acc5706d3 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 1 Dec 2016 12:50:40 +0100 Subject: only show contact related snackbars when conversation is single --- src/main/java/eu/siacs/conversations/ui/ConversationFragment.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 271aa26c..0ca868fe 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -917,15 +917,15 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa private void updateSnackBar(final Conversation conversation) { final Account account = conversation.getAccount(); - final Contact contact = conversation.getContact(); final int mode = conversation.getMode(); + final Contact contact = mode == Conversation.MODE_SINGLE ? conversation.getContact() : null; if (account.getStatus() == Account.State.DISABLED) { showSnackbar(R.string.this_account_is_disabled, R.string.enable, this.mEnableAccountListener); } else if (conversation.isBlocked()) { showSnackbar(R.string.contact_blocked, R.string.unblock, this.mUnblockClickListener); - } else if (!contact.showInRoster() && contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) { + } else if (contact != null && !contact.showInRoster() && contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) { showSnackbar(R.string.contact_added_you, R.string.add_back, this.mAddBackClickListener); - } else if (contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) { + } else if (contact != null && contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) { showSnackbar(R.string.contact_asks_for_presence_subscription, R.string.allow, this.mAllowPresenceSubscription); } else if (mode == Conversation.MODE_MULTI && !conversation.getMucOptions().online() -- cgit v1.2.3