Fix NPE in move messages

Bug: 5452020
Change-Id: Id8fca21692ad1a70a2114eaa7fec6bcecab6cab6
This commit is contained in:
Ben Komalo 2011-10-16 18:13:38 -07:00
parent 1f6769facc
commit a007d79c3f

View File

@ -21,6 +21,7 @@ import android.app.ListFragment;
import android.app.LoaderManager; import android.app.LoaderManager;
import android.content.ClipData; import android.content.ClipData;
import android.content.ContentUris; import android.content.ContentUris;
import android.content.Context;
import android.content.Loader; import android.content.Loader;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
@ -843,8 +844,14 @@ public class MessageListFragment extends ListFragment
@Override @Override
public void onMoveToMailboxSelected(long newMailboxId, long[] messageIds) { public void onMoveToMailboxSelected(long newMailboxId, long[] messageIds) {
final Context context = getActivity();
if (context == null) {
// Detached from activity. This callback was really delayed or a monkey was involved.
return;
}
mCallback.onAdvancingOpAccepted(Utility.toLongSet(messageIds)); mCallback.onAdvancingOpAccepted(Utility.toLongSet(messageIds));
ActivityHelper.moveMessages(getActivity(), newMailboxId, messageIds); ActivityHelper.moveMessages(context, newMailboxId, messageIds);
// Move is async, so we can't refresh now. Instead, just clear the selection. // Move is async, so we can't refresh now. Instead, just clear the selection.
onDeselectAll(); onDeselectAll();