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,10 +69,13 @@ 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) {
|
||||||
|
// This list is guaranteed to have at most one device in it.
|
||||||
|
let device = devices[0]._delegate;
|
||||||
active._primaryDevice = device;
|
active._primaryDevice = device;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var NMConnectionItem = class {
|
var NMConnectionItem = class {
|
||||||
|
Loading…
Reference in New Issue
Block a user