From b928fadba7dbe88a9a145ea238568bb25fe45be6 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 24 Oct 2023 20:44:25 -0700 Subject: [PATCH] LibPDF: Swap int and array branches in outline item reading No intended behavior change. It does have the effect that indirect object references now go down the array path instead of the number path. They still fall over there, but now that's easy to fix. --- Userland/Libraries/LibPDF/Fonts/Type0Font.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibPDF/Fonts/Type0Font.cpp b/Userland/Libraries/LibPDF/Fonts/Type0Font.cpp index 4742925965..714be2ebce 100644 --- a/Userland/Libraries/LibPDF/Fonts/Type0Font.cpp +++ b/Userland/Libraries/LibPDF/Fonts/Type0Font.cpp @@ -134,12 +134,7 @@ PDFErrorOr Type0Font::initialize(Document* document, NonnullRefPtrat(i); if (!pending_code.has_value()) { pending_code = value.to_int(); - } else if (value.has>()) { - auto array = value.get>()->cast(); - auto code = pending_code.release_value(); - for (auto& width : *array) - widths.set(code++, width.to_int()); - } else { + } else if (value.has_number()) { auto first_code = pending_code.release_value(); auto last_code = value.to_int(); auto width = widths_array->at(i + 1).to_int(); @@ -147,6 +142,11 @@ PDFErrorOr Type0Font::initialize(Document* document, NonnullRefPtr>()->cast(); + auto code = pending_code.release_value(); + for (auto& width : *array) + widths.set(code++, width.to_int()); } } }