Skip to content

Commit ab9af15

Browse files
authored
Merge pull request #79 from Jelcoo/main
Verify if deviceItem is not undefined
2 parents f2b33a5 + 82f679c commit ab9af15

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

libs/widgets.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ const SinkVolumeSlider = GObject.registerClass(class SinkVolumeSlider extends St
148148
if (this._name_binding) this._name_binding.unbind();
149149
// using the text from the output switcher of the master slider to allow compatibility with extensions
150150
// that changes it (like Quick Settings Audio Device Renamer)
151-
this._name_binding = Main.panel.statusArea.quickSettings._volumeOutput._output._deviceItems.get(device.get_id()).label.bind_property('text', label, 'text', GObject.BindingFlags.SYNC_CREATE);
151+
const deviceItem = Main.panel.statusArea.quickSettings._volumeOutput._output._deviceItems.get(device.get_id());
152+
if (deviceItem) this._name_binding = deviceItem.label.bind_property('text', label, 'text', GObject.BindingFlags.SYNC_CREATE);
152153
};
153154
let signal = stream.connect("notify::port", updater);
154155
updater();
@@ -705,7 +706,8 @@ const ApplicationVolumeSlider = GObject.registerClass(class ApplicationVolumeSli
705706
const item = new PopupImageMenuItem("", device.get_gicon());
706707
// using the text from the output switcher of the master slider to allow compatibility with extensions
707708
// that changes it (like Quick Settings Audio Device Renamer)
708-
Main.panel.statusArea.quickSettings._volumeOutput._output._deviceItems.get(device.get_id()).label.bind_property('text', item.label, 'text', GObject.BindingFlags.SYNC_CREATE);
709+
const deviceItem = Main.panel.statusArea.quickSettings._volumeOutput._output._deviceItems.get(device.get_id());
710+
if (deviceItem) deviceItem.label.bind_property('text', item.label, 'text', GObject.BindingFlags.SYNC_CREATE);
709711
item.connect('activate', () => {
710712
const dev = this._lookupDevice(id);
711713
if (dev)

0 commit comments

Comments
 (0)