[gnome-shell/wip/fmuellner/unbreak-wifi-keynav: 112/113] network: Handle networks with no access points



commit c15e163eb1e6df8738121e8ca48bcfe38d920ac4
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Mar 2 23:31:36 2018 +0100

    network: Handle networks with no access points
    
    This avoids a couple of warnings when encountering such a network.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/76

 js/ui/status/network.js | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index a75993612..a71297eed 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -995,8 +995,16 @@ var NMWirelessDialog = new Lang.Class({
         else if (!oneHasConnection && twoHasConnection)
             return 1;
 
-        let oneStrength = one.accessPoints[0].strength;
-        let twoStrength = two.accessPoints[0].strength;
+        let oneAp = one.accessPoints[0] || null;
+        let twoAp = two.accessPoints[0] || null;
+
+        if (oneAp != null && twoAp == null)
+            return -1;
+        else if (oneAp == null && twoAp != null)
+            return 1;
+
+        let oneStrength = oneAp.strength;
+        let twoStrength = twoAp.strength;
 
         // place stronger connections first
         if (oneStrength != twoStrength)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]