JasonLG1979 / gnome-shell-extension-mpris-indicator-button

A full featured MPRIS indicator button extension for GNOME Shell 3.38+
https://extensions.gnome.org/extension/1379/mpris-indicator-button/
GNU General Public License v3.0
159 stars 21 forks source link

Gtk.IconTheme.get_default() can be NULL. Make chained has_icon call (in _getIcon) more robust. #61

Closed Mershl closed 3 years ago

Mershl commented 3 years ago

Fixing #60. Gtk.IconTheme.get_default() can return NULL and will break the extension. Add a check before the chained call to .has_icon().

I'm open to suggestions if there's better JS syntax available for this case.

Shorter syntax would be Optional Chaning in JS, but it's marked "experimental". Not sure about the mozjs compatibility of older GNOME versions. -> https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Operators/Optional_chaining

JasonLG1979 commented 3 years ago

Sorry about the delay. Thanks @Mershl