From 3141f06472ae9683b2065014e233258a6a6c9cc6 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Wed, 27 May 2015 23:16:39 +0200 Subject: [PATCH] Fix crash due to non-locatable icon names (#199) --- lib/solaar/ui/icons.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/solaar/ui/icons.py b/lib/solaar/ui/icons.py index fd836fec..a40985cd 100644 --- a/lib/solaar/ui/icons.py +++ b/lib/solaar/ui/icons.py @@ -222,8 +222,11 @@ def device_icon_name(name, kind=None): def icon_file(name, size=_LARGE_SIZE): _init_icon_paths() - if _default_theme.has_icon(name): - theme_icon = _default_theme.lookup_icon(name, size, 0) + # has_icon() somehow returned False while lookup_icon returns non-None. + # I guess it happens because share/solaar/icons/ has no hicolor and + # resolution subdirs + theme_icon = _default_theme.lookup_icon(name, size, 0) + if theme_icon: file_name = theme_icon.get_filename() # if _log.isEnabledFor(_DEBUG): # _log.debug("icon %s(%d) => %s", name, size, file_name)