Fix for NPE when group selection fragment is no longer attached to activity.

This commit is contained in:
Moxie Marlinspike 2013-05-30 20:35:56 -07:00
parent 0534f9d95a
commit ad1d927437
2 changed files with 3 additions and 3 deletions

View File

@ -84,7 +84,7 @@ public class ContactSelectionActivity extends PassphraseRequiredSherlockFragment
private void handleSelectionFinished() { private void handleSelectionFinished() {
recipients = contactsFragment.getSelectedContacts(); recipients = contactsFragment.getSelectedContacts();
recipients.append(recentFragment.getSelectedContacts()); recipients.append(recentFragment.getSelectedContacts());
recipients.append(groupsFragment.getSelectedContacts()); recipients.append(groupsFragment.getSelectedContacts(this));
Intent resultIntent = getIntent(); Intent resultIntent = getIntent();
resultIntent.putExtra("recipients", this.recipients); resultIntent.putExtra("recipients", this.recipients);

View File

@ -84,12 +84,12 @@ public class ContactSelectionGroupsFragment extends SherlockListFragment
this.getListView().setFocusable(true); this.getListView().setFocusable(true);
} }
public Recipients getSelectedContacts() { public Recipients getSelectedContacts(Context context) {
List<Recipient> recipientList = new LinkedList<Recipient>(); List<Recipient> recipientList = new LinkedList<Recipient>();
for (GroupData groupData : selectedGroups.values()) { for (GroupData groupData : selectedGroups.values()) {
List<ContactData> contactDataList = ContactAccessor.getInstance() List<ContactData> contactDataList = ContactAccessor.getInstance()
.getGroupMembership(getActivity(), groupData.id); .getGroupMembership(context, groupData.id);
Log.w("GroupSelectionListActivity", "Got contacts in group: " + contactDataList.size()); Log.w("GroupSelectionListActivity", "Got contacts in group: " + contactDataList.size());