IconEntry, set_icon_from_name: handle case when icon can not be found cleanly
Sugar crashes if the sugar theme has not been set (in sugar-session) in the set_icon_from_name method since some if the requested icons can not be found. Handle that case cleanly. Signed-off-by: Simon Schampijer <simon@laptop.org> Acked-by: Manuel Quiñones <manuq@laptop.org>
This commit is contained in:
parent
39226e69c5
commit
d4934d73a7
@ -15,6 +15,8 @@
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
import logging
|
||||
|
||||
from gi.repository import GObject
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gdk
|
||||
@ -42,6 +44,10 @@ class IconEntry(Gtk.Entry):
|
||||
icon_info = icon_theme.lookup_icon(name,
|
||||
Gtk.IconSize.SMALL_TOOLBAR,
|
||||
0)
|
||||
if not icon_info:
|
||||
logging.warning('IconEntry set_icon_from_name: icon \'%s\' not '
|
||||
'found in the theme.', name)
|
||||
return
|
||||
|
||||
if icon_info.get_filename().endswith('.svg'):
|
||||
loader = _SVGLoader()
|
||||
|
Loading…
Reference in New Issue
Block a user