summaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDFPageDocumentHelper.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/libqpdf/QPDFPageDocumentHelper.cc b/libqpdf/QPDFPageDocumentHelper.cc
index 39b2800a..31d84e4b 100644
--- a/libqpdf/QPDFPageDocumentHelper.cc
+++ b/libqpdf/QPDFPageDocumentHelper.cc
@@ -67,9 +67,11 @@ QPDFPageDocumentHelper::flattenAnnotations(
for (auto& ph: getAllPages()) {
QPDFObjectHandle resources = ph.getAttribute("/Resources", true);
if (!resources.isDictionary()) {
- // This should never happen and is not exercised in the
- // test suite
- resources = QPDFObjectHandle::newDictionary();
+ QTC::TC(
+ "qpdf",
+ "QPDFPageDocumentHelper flatten resources missing or invalid");
+ resources = ph.getObjectHandle().replaceKeyAndGetNew(
+ "/Resources", QPDFObjectHandle::newDictionary());
}
flattenAnnotationsForPage(
ph, resources, afdh, required_flags, forbidden_flags);