Check if file is successfully opened

pull/3236/head
Andrei Kortunov 6 months ago
parent dc7407a34c
commit 871263d436

@ -36,7 +36,12 @@ namespace Misc
return QIcon();
QFile iconFile(fileName);
iconFile.open(QIODevice::ReadOnly);
if (!iconFile.open(QIODevice::ReadOnly))
{
qDebug() << "Failed to open icon file:" << fileName;
return QIcon();
}
auto content = iconFile.readAll();
if (!content.startsWith("<?xml"))
return QIcon(fileName);

@ -43,7 +43,12 @@ namespace Platform
setStyle("windows");
QFile file(getStyleSheetPath());
file.open(QIODevice::ReadOnly);
if (!file.open(QIODevice::ReadOnly))
{
qDebug() << "Failed to open style sheet file:" << getStyleSheetPath();
return;
}
setStyleSheet(file.readAll());
}
}
@ -60,7 +65,12 @@ namespace Platform
setStyle("windows");
QFile file(getStyleSheetPath());
file.open(QIODevice::ReadOnly);
if (!file.open(QIODevice::ReadOnly))
{
qDebug() << "Failed to open style sheet file:" << getStyleSheetPath();
return;
}
setStyleSheet(file.readAll());
}
else

Loading…
Cancel
Save