mirror of
https://github.com/OpenMW/openmw.git
synced 2025-07-14 23:31:41 +00:00
Check if file is successfully opened
This commit is contained in:
parent
dc7407a34c
commit
871263d436
2 changed files with 18 additions and 3 deletions
|
@ -36,7 +36,12 @@ namespace Misc
|
||||||
return QIcon();
|
return QIcon();
|
||||||
|
|
||||||
QFile iconFile(fileName);
|
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();
|
auto content = iconFile.readAll();
|
||||||
if (!content.startsWith("<?xml"))
|
if (!content.startsWith("<?xml"))
|
||||||
return QIcon(fileName);
|
return QIcon(fileName);
|
||||||
|
|
|
@ -43,7 +43,12 @@ namespace Platform
|
||||||
setStyle("windows");
|
setStyle("windows");
|
||||||
|
|
||||||
QFile file(getStyleSheetPath());
|
QFile file(getStyleSheetPath());
|
||||||
file.open(QIODevice::ReadOnly);
|
if (!file.open(QIODevice::ReadOnly))
|
||||||
|
{
|
||||||
|
qDebug() << "Failed to open style sheet file:" << getStyleSheetPath();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setStyleSheet(file.readAll());
|
setStyleSheet(file.readAll());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +65,12 @@ namespace Platform
|
||||||
setStyle("windows");
|
setStyle("windows");
|
||||||
|
|
||||||
QFile file(getStyleSheetPath());
|
QFile file(getStyleSheetPath());
|
||||||
file.open(QIODevice::ReadOnly);
|
if (!file.open(QIODevice::ReadOnly))
|
||||||
|
{
|
||||||
|
qDebug() << "Failed to open style sheet file:" << getStyleSheetPath();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setStyleSheet(file.readAll());
|
setStyleSheet(file.readAll());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue