LibPDF: Fix bad resolve_to calls in Document

We can't call resolve_to with IndirectValue{,Ref}, since the values
will obviously be resolved, and will not give us the object of the
correct type.
This commit is contained in:
Matthew Olsson 2021-05-10 11:41:36 -07:00 committed by Andreas Kling
parent 4479c1bff0
commit 309105678b
Notes: sideshowbarker 2024-07-18 17:51:08 +09:00

View file

@ -148,7 +148,7 @@ void Document::add_page_tree_node_to_page_tree(NonnullRefPtr<DictObject> page_tr
// these pages to the overall page tree
for (auto& value : *kids_array) {
auto reference = resolve_to<IndirectValueRef>(value);
auto reference = object_cast<IndirectValueRef>(value.as_object());
auto byte_offset = m_xref_table.byte_offset_for_object(reference->index());
auto maybe_page_tree_node = m_parser.conditionally_parse_page_tree_node_at_offset(byte_offset);
if (maybe_page_tree_node) {
@ -163,7 +163,7 @@ void Document::add_page_tree_node_to_page_tree(NonnullRefPtr<DictObject> page_tr
// We know all of the kids are leaf nodes
for (auto& value : *kids_array) {
auto reference = resolve_to<IndirectValueRef>(value);
auto reference = object_cast<IndirectValueRef>(value.as_object());
m_page_object_indices.append(reference->index());
}
}