Bug 1317198 - Check if a tab is null before trying to get its id in GeckoApp.onPause() r=sebastian
authorDylan Roeh <droeh@mozilla.com>
Wed, 16 Nov 2016 09:07:27 -0600
changeset 439881 0f8126c38179a6475b550ed97f0dfac42c4899b6
parent 439880 efe1e3b8cc1714dbdc456b80dfa4578a5192f5b7
child 439882 326453c91392f00a0e83e82b48e67c28acc576b4
child 439934 f5521b22fd95004b01f6151ab8c5145e848d0a20
push id36113
push userbmo:afarre@mozilla.com
push dateWed, 16 Nov 2016 18:15:04 +0000
reviewerssebastian
bugs1317198
milestone53.0a1
Bug 1317198 - Check if a tab is null before trying to get its id in GeckoApp.onPause() r=sebastian
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -2151,17 +2151,20 @@ public abstract class GeckoApp
     @Override
     public void onPause()
     {
         if (mIsAbortingAppLaunch) {
             super.onPause();
             return;
         }
 
-        lastSelectedTabId = Tabs.getInstance().getSelectedTab().getId();
+        final Tab selectedTab = Tabs.getInstance().getSelectedTab();
+        if (selectedTab != null) {
+            lastSelectedTabId = selectedTab.getId();
+        }
         lastActiveGeckoApp = new WeakReference<GeckoApp>(this);
 
         final HealthRecorder rec = mHealthRecorder;
         final Context context = this;
 
         // In some way it's sad that Android will trigger StrictMode warnings
         // here as the whole point is to save to disk while the activity is not
         // interacting with the user.