Bug 1025931 - Crash java.lang.NullPointerException in in org.mozilla.gecko.GeckoAppShell.getContext. r=snorp, a=lmandel
authorBrad Lassey <blassey@mozilla.com>
Thu, 26 Jun 2014 09:37:47 -0400
changeset 200722 da28853720666883551b11c1396a9a826c8272b8
parent 200721 8409d8071e2077cf459478fb4f0d099f4739514e
child 200723 025d96672f656aaa7a9f25ccbd0243701103d40e
push id486
push userasasaki@mozilla.com
push dateMon, 14 Jul 2014 18:39:42 +0000
treeherdermozilla-release@d33428174ff1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp, lmandel
bugs1025931
milestone31.0
Bug 1025931 - Crash java.lang.NullPointerException in in org.mozilla.gecko.GeckoAppShell.getContext. r=snorp, a=lmandel
mobile/android/base/GeckoAppShell.java
mobile/android/base/GeckoApplication.java
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -2063,16 +2063,18 @@ public class GeckoAppShell
             return null;
         }
     }
 
     private static ContextGetter sContextGetter;
 
     @WrapElementForJNI(allowMultithread = true)
     public static Context getContext() {
+        if (sContextGetter == null)
+            return null;
         return sContextGetter.getContext();
     }
 
     public static void setContextGetter(ContextGetter cg) {
         sContextGetter = cg;
     }
 
     public static SharedPreferences getSharedPreferences() {
--- a/mobile/android/base/GeckoApplication.java
+++ b/mobile/android/base/GeckoApplication.java
@@ -97,16 +97,18 @@ public class GeckoApplication extends Ap
                 }
             });
         }
         GeckoConnectivityReceiver.getInstance().stop();
         GeckoNetworkManager.getInstance().stop();
     }
 
     public void onActivityResume(GeckoActivityStatus activity) {
+	GeckoAppShell.setContextGetter(this);
+
         if (mPausedGecko) {
             GeckoAppShell.sendEventToGecko(GeckoEvent.createAppForegroundingEvent());
             mPausedGecko = false;
         }
 
         final Context applicationContext = getApplicationContext();
         GeckoBatteryManager.getInstance().start(applicationContext);
         GeckoConnectivityReceiver.getInstance().start(applicationContext);