~brian-murray/apport/pre-release-freeze

« back to all changes in this revision

Viewing changes to apport/ui.py

  • Committer: Martin Pitt
  • Date: 2012-08-24 10:31:13 UTC
  • Revision ID: martin.pitt@canonical.com-20120824103113-mgz543419xm5q3eb
* Fix crash on broken .desktop files. (LP: #1039889)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1251
1251
        if not desktop_file:
1252
1252
            return None
1253
1253
 
1254
 
        cp = ConfigParser(interpolation=None)
1255
 
        cp.read(desktop_file, encoding='UTF-8')
 
1254
        cp = ConfigParser(interpolation=None, strict=False)
 
1255
        try:
 
1256
            cp.read(desktop_file, encoding='UTF-8')
 
1257
        except Exception as e:
 
1258
            if 'onfig' in str(e.__class__) and 'arser' in str(e.__class__):
 
1259
                sys.stderr.write('Warning! %s is broken: %s\n' % (desktop_file, str(e)))
 
1260
                return None
 
1261
            else:
 
1262
                raise
1256
1263
        if not cp.has_section('Desktop Entry'):
1257
1264
            return None
1258
1265
        result = dict(cp.items('Desktop Entry'))