network: don't assume NMActiveConnection has a device
In practice this has been seen to fail: JS ERROR: TypeError: active.get_devices(...)[0] is undefined ensureActiveConnectionProps@resource:///org/gnome/shell/ui/status/network.js:73:22 _getMainConnection@resource:///org/gnome/shell/ui/status/network.js:1791:13 _syncMainConnection@resource:///org/gnome/shell/ui/status/network.js:1809:32 https://gitlab.gnome.org/GNOME/gnome-shell/issues/1406
This commit is contained in:
parent
ccf646f54a
commit
94ba52af0c
@ -69,9 +69,12 @@ function ssidToLabel(ssid) {
|
|||||||
|
|
||||||
function ensureActiveConnectionProps(active, client) {
|
function ensureActiveConnectionProps(active, client) {
|
||||||
if (!active._primaryDevice) {
|
if (!active._primaryDevice) {
|
||||||
// This list is guaranteed to have only one device in it.
|
let devices = active.get_devices();
|
||||||
let device = active.get_devices()[0]._delegate;
|
if (devices.length > 0) {
|
||||||
active._primaryDevice = device;
|
// This list is guaranteed to have at most one device in it.
|
||||||
|
let device = devices[0]._delegate;
|
||||||
|
active._primaryDevice = device;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user