From ad1d927437a27fdd2f1f701f9f73d368afd613e0 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Thu, 30 May 2013 20:35:56 -0700 Subject: [PATCH] Fix for NPE when group selection fragment is no longer attached to activity. --- src/org/thoughtcrime/securesms/ContactSelectionActivity.java | 2 +- .../securesms/ContactSelectionGroupsFragment.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/org/thoughtcrime/securesms/ContactSelectionActivity.java b/src/org/thoughtcrime/securesms/ContactSelectionActivity.java index 1388ae5d30..fc30c7eb87 100644 --- a/src/org/thoughtcrime/securesms/ContactSelectionActivity.java +++ b/src/org/thoughtcrime/securesms/ContactSelectionActivity.java @@ -84,7 +84,7 @@ public class ContactSelectionActivity extends PassphraseRequiredSherlockFragment private void handleSelectionFinished() { recipients = contactsFragment.getSelectedContacts(); recipients.append(recentFragment.getSelectedContacts()); - recipients.append(groupsFragment.getSelectedContacts()); + recipients.append(groupsFragment.getSelectedContacts(this)); Intent resultIntent = getIntent(); resultIntent.putExtra("recipients", this.recipients); diff --git a/src/org/thoughtcrime/securesms/ContactSelectionGroupsFragment.java b/src/org/thoughtcrime/securesms/ContactSelectionGroupsFragment.java index 88421ba0f3..48b90be1df 100644 --- a/src/org/thoughtcrime/securesms/ContactSelectionGroupsFragment.java +++ b/src/org/thoughtcrime/securesms/ContactSelectionGroupsFragment.java @@ -84,12 +84,12 @@ public class ContactSelectionGroupsFragment extends SherlockListFragment this.getListView().setFocusable(true); } - public Recipients getSelectedContacts() { + public Recipients getSelectedContacts(Context context) { List recipientList = new LinkedList(); for (GroupData groupData : selectedGroups.values()) { List contactDataList = ContactAccessor.getInstance() - .getGroupMembership(getActivity(), groupData.id); + .getGroupMembership(context, groupData.id); Log.w("GroupSelectionListActivity", "Got contacts in group: " + contactDataList.size());