Bug 965346 - Part 1: Ensure that callback is called, even when reply is null. r=mrbkap
authorTed Clancy (:tedders1) <tclancy@mozilla.com>
Thu, 13 Feb 2014 08:51:12 -0800
changeset 169995 bfd52575b6d39a61fbab1387c3f6d846ea2949fe
parent 169944 3762e1037b596a3f6f36bf42144aae70482f1ecf
child 169996 7c01cbcd31ebdeeb74233349d9b76191ee0d07ad
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersmrbkap
bugs965346
milestone30.0a1
Bug 965346 - Part 1: Ensure that callback is called, even when reply is null. r=mrbkap
dom/wifi/WifiWorker.js
--- a/dom/wifi/WifiWorker.js
+++ b/dom/wifi/WifiWorker.js
@@ -1070,18 +1070,18 @@ var WifiManager = (function() {
     }
     // If config didn't contain any of the fields we want, don't lose the error callback.
     if (done == networkConfigurationFields.length)
       callback(false);
   }
   manager.getConfiguredNetworks = function(callback) {
     wifiCommand.listNetworks(function (reply) {
       var networks = Object.create(null);
-      var lines = reply.split("\n");
-      if (lines.length === 1) {
+      var lines = reply ? reply.split("\n") : 0;
+      if (lines.length <= 1) {
         // We need to make sure we call the callback even if there are no
         // configured networks.
         callback(networks);
         return;
       }
 
       var done = 0;
       var errors = 0;