Check return value of 'QFile::open(QIODeviceBase::OpenMode)' (#4274)
This commit is contained in:
@@ -59,9 +59,14 @@ QString getCreditsHtml()
|
||||
QString getLicenseHtml()
|
||||
{
|
||||
QFile dataFile(":/documents/COPYING.md");
|
||||
dataFile.open(QIODevice::ReadOnly);
|
||||
QString output = markdownToHTML(dataFile.readAll());
|
||||
return output;
|
||||
if (dataFile.open(QIODevice::ReadOnly)) {
|
||||
QString output = markdownToHTML(dataFile.readAll());
|
||||
dataFile.close();
|
||||
return output;
|
||||
} else {
|
||||
qWarning() << "Failed to open file '" << dataFile.fileName() << "' for reading!";
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user