Fix possible NPE on People
mContactListFilterController may become null if People app just
redirects Intents to somewhere else (like contacts detail page).
Bug: 5557277
Change-Id: I3b1859ec3cd8f85a9ced0c926f7335772b03f70c
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index 031f0c8..5afcbbd 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -472,12 +472,15 @@
@Override
protected void onDestroy() {
- // mActionBarAdapter will be null here when redirecting to another activity in
- // configureContentView().
+ // Some of variables will be null if this Activity redirects Intent.
+ // See also onCreate() or other methods called during the Activity's initialization.
if (mActionBarAdapter != null) {
mActionBarAdapter.setListener(null);
}
- mContactListFilterController.removeListener(this);
+ if (mContactListFilterController != null) {
+ mContactListFilterController.removeListener(this);
+ }
+
super.onDestroy();
}