fix NPE in onDestroy
Bug 3255996
In case of a search we might exit the browser without ever creating a
controller; added check to lifecycle methods.
Change-Id: I5fc358c31263ff63297a18944dce230f48886628
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 1c15153..7c0f7c8 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -130,7 +130,9 @@
if (LOGV_ENABLED) {
Log.v(LOGTAG, "BrowserActivity.onResume: this=" + this);
}
- mController.onResume();
+ if (mController != null) {
+ mController.onResume();
+ }
}
@Override
@@ -167,7 +169,9 @@
@Override
protected void onPause() {
- mController.onPause();
+ if (mController != null) {
+ mController.onPause();
+ }
super.onPause();
}
@@ -177,7 +181,9 @@
Log.v(LOGTAG, "BrowserActivity.onDestroy: this=" + this);
}
super.onDestroy();
- mController.onDestroy();
+ if (mController != null) {
+ mController.onDestroy();
+ }
mUi = null;
mController = null;
}