Bug 1095914 - Fix NPE from no app context. r=vng, a=lsblakk
authorGarvan Keeley <gkeeley@mozilla.com>
Sat, 08 Nov 2014 09:09:00 -0500
changeset 234000 5c8a21d22dc32013747d837d045b805cd5975c48
parent 233999 a3ae3d724956576aafc6609d961ed28d75de3cd7
child 234001 2f5d3b2f5f64e86b6442bba620fb9ed90ce0953f
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvng, lsblakk
bugs1095914
milestone35.0a2
Bug 1095914 - Fix NPE from no app context. r=vng, a=lsblakk https://github.com/mozilla/MozStumbler/pull/1195 1187 - NPE - Appears to be from no app context
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/ScanManager.java
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/ScanManager.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/ScanManager.java
@@ -93,16 +93,21 @@ public class ScanManager {
     }
 
     public void startScanning(Context context) {
         if (mIsScanning) {
             return;
         }
 
         mContext = context.getApplicationContext();
+        if (mContext == null) {
+            Log.w(LOG_TAG, "No app context available.");
+            return;
+        }
+
         if (mGPSScanner == null) {
             mGPSScanner = new GPSScanner(context, this);
             mWifiScanner = new WifiScanner(context);
             mCellScanner = new CellScanner(context);
         }
 
         if (AppGlobals.isDebug) {
             Log.d(LOG_TAG, "Scanning started...");