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,11 +69,14 @@ function ssidToLabel(ssid) {
|
||||
|
||||
function ensureActiveConnectionProps(active, client) {
|
||||
if (!active._primaryDevice) {
|
||||
// This list is guaranteed to have only one device in it.
|
||||
let device = active.get_devices()[0]._delegate;
|
||||
let devices = active.get_devices();
|
||||
if (devices.length > 0) {
|
||||
// This list is guaranteed to have at most one device in it.
|
||||
let device = devices[0]._delegate;
|
||||
active._primaryDevice = device;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var NMConnectionItem = class {
|
||||
constructor(section, connection) {
|
||||
|
Loading…
Reference in New Issue
Block a user