From 4fa5d701d536370084afa89acf43de79e4f14e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 7 Mar 2019 20:26:12 +0100 Subject: [PATCH] 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(); }