Bug 888201 - java.lang.NullPointerException: at org.mozilla.gecko.GeckoApp.collectAndReportLocInfo(GeckoApp.java). r=kats, a=bajaj
authorBrad Lassey <blassey@mozilla.com>
Fri, 28 Jun 2013 12:42:28 -0400
changeset 147811 7568be854b6570a032a833b38bc11a22ce671277
parent 147810 605b49d10be6895b5569f9f343b943dc3b972d5c
child 147812 9f5d65c04085338724d890f191cf379fece3c1ad
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats, bajaj
bugs888201
milestone24.0a2
Bug 888201 - java.lang.NullPointerException: at org.mozilla.gecko.GeckoApp.collectAndReportLocInfo(GeckoApp.java). r=kats, a=bajaj
mobile/android/base/GeckoApp.java
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -2421,32 +2421,34 @@ abstract public class GeckoApp
             DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
             locInfo.put("time", df.format(new Date(location.getTime())));
             locInfo.put("cell", cellInfo);
 
             MessageDigest digest = MessageDigest.getInstance("SHA-1");
 
             JSONArray wifiInfo = new JSONArray();
             List<ScanResult> aps = wm.getScanResults();
-            for (ScanResult ap : aps) {
-                if (!shouldLog(ap))
-                    continue;
-                StringBuilder sb = new StringBuilder();
-                try {
-                    byte[] result = digest.digest((ap.BSSID + ap.SSID).getBytes("UTF-8"));
-                    for (byte b : result) sb.append(String.format("%02X", b));
+            if (aps != null) {
+                for (ScanResult ap : aps) {
+                    if (!shouldLog(ap))
+                        continue;
+                    StringBuilder sb = new StringBuilder();
+                    try {
+                        byte[] result = digest.digest((ap.BSSID + ap.SSID).getBytes("UTF-8"));
+                        for (byte b : result) sb.append(String.format("%02X", b));
 
-                    JSONObject obj = new JSONObject();
+                        JSONObject obj = new JSONObject();
 
-                    obj.put("key", sb.toString());
-                    obj.put("frequency", ap.frequency);
-                    obj.put("signal", ap.level);
-                    wifiInfo.put(obj);
-                } catch (UnsupportedEncodingException uee) {
-                    Log.w(LOGTAG, "can't encode the key", uee);
+                        obj.put("key", sb.toString());
+                        obj.put("frequency", ap.frequency);
+                        obj.put("signal", ap.level);
+                        wifiInfo.put(obj);
+                    } catch (UnsupportedEncodingException uee) {
+                        Log.w(LOGTAG, "can't encode the key", uee);
+                    }
                 }
             }
             locInfo.put("wifi", wifiInfo);
         } catch (JSONException jsonex) {
             Log.w(LOGTAG, "json exception", jsonex);
         } catch (NoSuchAlgorithmException nsae) {
             Log.w(LOGTAG, "can't creat a SHA1", nsae);
         }