[gnome-shell] network: don't crash because a device doesn't have a description yet



commit f7284caefd9b344122892bb707ceb7125249cf1a
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sun Aug 18 20:16:49 2013 +0200

    network: don't crash because a device doesn't have a description yet
    
    Descriptions are only added after all devices are read (thanks
    to the disambiguation in libnm-gtk), but we use them immediately
    when we call _sync() in various points (such as checkConnection())
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706262

 js/ui/status/network.js |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index e786105..e751980 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -182,7 +182,14 @@ const NMConnectionSection = new Lang.Class({
 
         this.item.status.text = this._getStatus();
         this.item.icon.icon_name = this._getMenuIcon();
-        this.item.label.text = this._getDescription();
+
+        // desc can be undefined at cold-plug, before we called
+        // NMGtk.disambiguate_device_names() at least once
+        let desc = this._getDescription();
+        if (desc)
+            this.item.label.text = desc;
+        else
+            this.item.label.text = '';
     },
 
     _getStatus: function() {


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