Merge "Fix NPE in ManageApps when switching orientation." into jb-dev

This commit is contained in:
Amith Yamasani
2012-05-01 16:15:25 -07:00
committed by Android (Google) Code Review

View File

@@ -759,6 +759,9 @@ public class ManageApplications extends Fragment implements
static final int VIEW_RUNNING = 2; static final int VIEW_RUNNING = 2;
void updateStorageUsage() { void updateStorageUsage() {
// Fragment view not yet created?
if (mRootView == null) return;
if (mCurView == VIEW_RUNNING) { if (mCurView == VIEW_RUNNING) {
return; return;
} }
@@ -939,6 +942,8 @@ public class ManageApplications extends Fragment implements
@Override @Override
public void onServiceConnected(ComponentName name, IBinder service) { public void onServiceConnected(ComponentName name, IBinder service) {
mContainerService = IMediaContainerService.Stub.asInterface(service); mContainerService = IMediaContainerService.Stub.asInterface(service);
// Make sure this callback didn't come at an inopportune time.
if (getActivity() == null) return;
updateStorageUsage(); updateStorageUsage();
} }