Check existance of theme icon before loading it
authorWuzzy <Wuzzy2@mail.ru>
Mon, 19 Mar 2018 13:35:13 +0100
changeset 13257 5200231eb120
parent 13256 edb2f654f8f6
child 13258 dd054edd56df
Check existance of theme icon before loading it
QTfrontend/model/ThemeModel.cpp
--- a/QTfrontend/model/ThemeModel.cpp	Mon Mar 19 00:09:07 2018 +0100
+++ b/QTfrontend/model/ThemeModel.cpp	Mon Mar 19 13:35:13 2018 +0100
@@ -145,8 +145,12 @@
         dataset.insert(Qt::DisplayRole, (isDLC ? "*" : "") + theme);
 
         // load and set preview icon
-        QIcon preview(QString("physfs://Themes/%1/icon@2x.png").arg(theme));
-        dataset.insert(Qt::DecorationRole, preview);
+        iconpath = QString("physfs://Themes/%1/icon@2x.png").arg(theme);
+        if (QFile::exists(iconpath))
+        {
+            QIcon preview(QString("physfs://Themes/%1/icon@2x.png").arg(theme));
+            dataset.insert(Qt::DecorationRole, preview);
+        }
 
         m_data.append(dataset);
     }