Open With: Use a blank icon instead of erroring out on linux in case of malformed desktop files or icon themes

This commit is contained in:
Kovid Goyal 2016-01-09 16:56:39 +05:30
parent 3e5f0e4bc7
commit 592fbc1490
2 changed files with 4 additions and 0 deletions

View File

@ -184,6 +184,8 @@ else:
def entry_to_item(entry, parent):
icon_path = entry.get('Icon') or I('blank.png')
if not isinstance(icon_path, basestring):
icon_path = I('blank.png')
ans = QListWidgetItem(QIcon(icon_path), entry.get('Name') or _('Unknown'), parent)
ans.setData(ENTRY_ROLE, entry)
comment = (entry.get('Comment') or '')

View File

@ -191,6 +191,8 @@ def find_programs(extensions):
data['Icon'] = icon
else:
data.pop('Icon')
if not isinstance(data.get('Icon'), basestring):
data.pop('Icon', None)
for k in ('Name', 'GenericName', 'Comment'):
val = data.get(k)
if val: