mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 10:58:58 +00:00
Refactor test for /Pages object in QPDF::copyForeignObject
Test for missing object before accessing obj_copier.object_map.
This commit is contained in:
parent
ca79fcb26e
commit
b0c3ea2bb6
@ -2034,13 +2034,13 @@ QPDF::copyForeignObject(QPDFObjectHandle foreign)
|
||||
}
|
||||
obj_copier.to_copy.clear();
|
||||
|
||||
auto& result = obj_copier.object_map[foreign.getObjGen()];
|
||||
if (!result.isInitialized()) {
|
||||
result = QPDFObjectHandle::newNull();
|
||||
warn(damagedPDF("Unexpected reference to /Pages object while copying foreign object. "
|
||||
"Replacing with Null object."));
|
||||
auto og = foreign.getObjGen();
|
||||
if (!obj_copier.object_map.count(og)) {
|
||||
warn(damagedPDF("unexpected reference to /Pages object while copying foreign object; "
|
||||
"replacing with null"));
|
||||
return QPDFObjectHandle::newNull();
|
||||
}
|
||||
return result;
|
||||
return obj_copier.object_map[foreign.getObjGen()];
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,2 +1,2 @@
|
||||
WARNING: minimal.pdf (object 6 0, offset 556): Unexpected reference to /Pages object while copying foreign object. Replacing with Null object.
|
||||
WARNING: minimal.pdf (object 6 0, offset 556): unexpected reference to /Pages object while copying foreign object; replacing with null
|
||||
test 25 done
|
||||
|
Loading…
Reference in New Issue
Block a user