mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-29 17:15:34 +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();
|
||||
|
||||
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…
Reference in a new issue