diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-03-22 17:31:37 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-04-04 10:49:23 +0100 |
commit | 7bd9aa191c97f169ca753d18c335310a5d17d790 (patch) | |
tree | f394d222eab27477e63776b44f8ebd39494a61f9 /src/gui/painting | |
parent | 0fb2e27710a89631c21ab1b00a8e126c60f49abc (diff) |
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>
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qpdf.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 85d3874f94..bf653cb3f4 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -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; |