Bug 1095914 - Fix NPE from no app context. r=vng
authorGarvan Keeley <gkeeley@mozilla.com>
Sat, 08 Nov 2014 09:09:00 -0500
changeset 240223 fb5f63e546482477f0d64fc0b4d74be4f5d2ad0b
parent 240222 76675cb8713837a9e5bed161af07d835607fef1a
child 240224 f23b9848820f967b1754157981d2c9bd69b612b9
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvng
bugs1095914
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1095914 - Fix NPE from no app context. r=vng 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...");