Bug 1138529 - Add null checks mDoorHangerPopup access in toolbar editing state. r=liuche, a=lmandel
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 05 Mar 2015 13:34:54 -0800
changeset 250307 b06724f2ed0a
parent 250306 5d0326e1f387
child 250308 a0dcce408108
push id4542
push userryanvm@gmail.com
push date2015-03-09 19:13 +0000
treeherdermozilla-beta@46392e569cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersliuche, lmandel
bugs1138529
milestone37.0
Bug 1138529 - Add null checks mDoorHangerPopup access in toolbar editing state. r=liuche, a=lmandel Note: the call in onStartEditing is intended to fix the bug, but the call in onStopEditing is similar enough that it makes sense to guard it as well.
mobile/android/base/BrowserApp.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -834,17 +834,19 @@ public class BrowserApp extends GeckoApp
             @Override
             public void onStartEditing() {
                 final Tab selectedTab = Tabs.getInstance().getSelectedTab();
                 if (selectedTab != null) {
                     selectedTab.setIsEditing(true);
                 }
 
                 // Temporarily disable doorhanger notifications.
-                mDoorHangerPopup.disable();
+                if (mDoorHangerPopup != null) {
+                    mDoorHangerPopup.disable();
+                }
             }
         });
 
         mBrowserToolbar.setOnStopEditingListener(new BrowserToolbar.OnStopEditingListener() {
             @Override
             public void onStopEditing() {
                 final Tab selectedTab = Tabs.getInstance().getSelectedTab();
                 if (selectedTab != null) {
@@ -857,17 +859,19 @@ public class BrowserApp extends GeckoApp
                 // ordinarily want to call it first. However, hideBrowserSearch changes the
                 // visibility of the HomePager and hideHomePager will take no action if the
                 // HomePager is hidden, so we want to call hideBrowserSearch to restore the
                 // HomePager visibility first.
                 hideBrowserSearch();
                 hideHomePager();
 
                 // Re-enable doorhanger notifications. They may trigger on the selected tab above.
-                mDoorHangerPopup.enable();
+                if (mDoorHangerPopup != null) {
+                    mDoorHangerPopup.enable();
+                }
             }
         });
 
         // Intercept key events for gamepad shortcuts
         mBrowserToolbar.setOnKeyListener(this);
     }
 
     private void showBookmarkDialog() {