mirror of
https://github.com/qpdf/qpdf.git
synced 2024-11-01 03:12:29 +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();
|
obj_copier.to_copy.clear();
|
||||||
|
|
||||||
auto& result = obj_copier.object_map[foreign.getObjGen()];
|
auto og = foreign.getObjGen();
|
||||||
if (!result.isInitialized()) {
|
if (!obj_copier.object_map.count(og)) {
|
||||||
result = QPDFObjectHandle::newNull();
|
warn(damagedPDF("unexpected reference to /Pages object while copying foreign object; "
|
||||||
warn(damagedPDF("Unexpected reference to /Pages object while copying foreign object. "
|
"replacing with null"));
|
||||||
"Replacing with Null object."));
|
return QPDFObjectHandle::newNull();
|
||||||
}
|
}
|
||||||
return result;
|
return obj_copier.object_map[foreign.getObjGen()];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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
|
test 25 done
|
||||||
|
Loading…
Reference in New Issue
Block a user