[gnome-shell] NMConnectionSection: don't remove connections that were never added



commit 522f3bf171dbf3e3378bf99b8c7500c63f62bd1d
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sat Mar 8 19:54:09 2014 +0100

    NMConnectionSection: don't remove connections that were never added
    
    NMApplet will call removeConnection() unconditionally on all sections,
    including those that had nothing to do with the connection in the first
    place.
    
    Fixes:
    
    Gjs-WARNING **: JS ERROR: TypeError: this._connectionItems.get(...) is undefined
    NMConnectionSection< removeConnection resource:///org/gnome/shell/ui/status/network.js:323
    wrapper resource:///org/gnome/gjs/modules/lang.js:169
    NMApplet< _connectionRemoved resource:///org/gnome/shell/ui/status/network.js:1885
    wrapper resource:///org/gnome/gjs/modules/lang.js:169
    
    https://bugzilla.gnome.org/show_bug.cgi?id=725958

 js/ui/status/network.js |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index b159e3c..ce6b004 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -293,8 +293,13 @@ const NMConnectionSection = new Lang.Class({
     },
 
     removeConnection: function(connection) {
-        this._connectionItems.get(connection.get_uuid()).destroy();
-        this._connectionItems.delete(connection.get_uuid());
+        let uuid = connection.get_uuid();
+        let item = this._connectionItems.get(uuid);
+        if (item == undefined)
+            return;
+
+        item.destroy();
+        this._connectionItems.delete(uuid);
 
         let pos = this._connections.indexOf(connection);
         this._connections.splice(pos, 1);


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