[gnome-shell/wip/fmuellner/fix-nm-icon] network: Catch errors when reading devices



commit 05b17c792acf0b7ae1f2547a3d86b7dab03ae02e
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Mar 7 20:26:12 2019 +0100

    network: Catch errors when reading devices
    
    NetworkManager added support for a new device - NMDeviceWifiP2P - but
    did not add the corresponding enum value in NMDeviceType. The return
    value for nm_device_get_device_type() is therefore "illegal" for the
    newly added device, and gjs throws an exception.
    
    This should ultimately be fixed in libnm, but as errors when adding
    one device shouldn't interfere with adding any other devices, catching
    exception is a good idea anyway, so do just that.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/1023

 js/ui/status/network.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 77a6202b8..e6551f217 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1673,7 +1673,11 @@ var NMApplet = class extends PanelMenu.SystemIndicator {
     _readDevices() {
         let devices = this._client.get_devices() || [ ];
         for (let i = 0; i < devices.length; ++i) {
-            this._deviceAdded(this._client, devices[i], true);
+            try {
+                this._deviceAdded(this._client, devices[i], true);
+            } catch (e) {
+                log(`Failed to add device ${devices[i]}: ${e}`);
+            }
         }
         this._syncDeviceNames();
     }


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