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

JS Error in _getIcon for Strawberry player (tested on Gnome 40) #60

Closed Mershl closed 2 years ago

Mershl commented 3 years ago

Describe the bug

JS error is visible in log when starting strawberry player (https://github.com/strawberrymusicplayer/strawberry). Spotify does not show this issue.

Gtk.IconTheme.get_default() can return NULL. _getIcon is not handling that case.

Steps To Reproduce:

  1. Have latest gnome-shell-extension-mpris-indicator-button installed
  2. Start strawberry player (tested with 0.9.3)
  3. Check logs e.g. journalctl -b -p4

Logs

JS ERROR: TypeError: Gtk.IconTheme.get_default() is null

System Details:

Mershl commented 3 years ago

A quick hack fixes the issue and let's the extension work as before.

<         return this.app_id && Gtk.IconTheme.get_default().has_icon(iconName) ? Gio.ThemedIcon.new(iconName) : null;
---
>         return this.app_id && (Gtk.IconTheme.get_default() ? Gtk.IconTheme.get_default().has_icon(iconName) : false) ? Gio.ThemedIcon.new(iconName) : null;        

Interesting enough. A nice icon is shown:

image

JasonLG1979 commented 3 years ago

@Mershl if that fixes the issue, put in a Pull Request and I'll give it a go, and if all goes well I'll merge it.