QPdf: assert that we can load the files from the resources

These are files under our control, but still, may get moved/renamed/...
by accident. Assert that we can open them.

Change-Id: I46987f2f12e04a8d7292652eb6440fa0f345175a
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
bb10
Giuseppe D'Angelo 2024-03-22 17:31:37 +01:00
parent 0fb2e27710
commit 7bd9aa191c
1 changed files with 4 additions and 2 deletions

View File

@ -1772,7 +1772,8 @@ int QPdfEnginePrivate::writeXmpDcumentMetaData()
const QString metaDataDate = timeStr + tzStr;
QFile metaDataFile(":/qpdf/qpdfa_metadata.xml"_L1);
metaDataFile.open(QIODevice::ReadOnly);
bool ok = metaDataFile.open(QIODevice::ReadOnly);
Q_ASSERT(ok);
metaDataContent = QString::fromUtf8(metaDataFile.readAll()).arg(producer.toHtmlEscaped(),
title.toHtmlEscaped(),
creator.toHtmlEscaped(),
@ -1798,7 +1799,8 @@ int QPdfEnginePrivate::writeOutputIntent()
const int colorProfile = addXrefEntry(-1);
{
QFile colorProfileFile(":/qpdf/sRGB2014.icc"_L1);
colorProfileFile.open(QIODevice::ReadOnly);
bool ok = colorProfileFile.open(QIODevice::ReadOnly);
Q_ASSERT(ok);
const QByteArray colorProfileData = colorProfileFile.readAll();
QByteArray data;