From d50af5f5a75eb17bef47049f0b256da3cda96322 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Thu, 22 Nov 2018 10:29:51 +0100 Subject: [PATCH] avoid crash in docker, due to UnicodeEncodeError --- src/urh/models/FileIconProvider.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/urh/models/FileIconProvider.py b/src/urh/models/FileIconProvider.py index 81f35001..c1f88df6 100644 --- a/src/urh/models/FileIconProvider.py +++ b/src/urh/models/FileIconProvider.py @@ -13,8 +13,12 @@ class FileIconProvider(QFileIconProvider): def icon(self, arg): if isinstance(arg, QFileInfo): - if (arg.isDir() and os.path.isfile(os.path.join(arg.filePath(), constants.PROJECT_FILE))) \ - or (arg.isFile() and arg.fileName() == constants.PROJECT_FILE): - return QIcon(":/icons/icons/appicon.png") + try: + if (arg.isDir() and os.path.isfile(os.path.join(arg.filePath(), constants.PROJECT_FILE))) \ + or (arg.isFile() and arg.fileName() == constants.PROJECT_FILE): + return QIcon(":/icons/icons/appicon.png") + except: + # In some environments (e.g. docker) there tend to be encoding errors + pass return super().icon(arg)