Check return value of 'virtual bool QFile::open(QIODeviceBase::OpenMode)'
Signed-off-by: Dylan Schooner <dschooner05@gmail.com>
This commit is contained in:
@@ -124,9 +124,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