1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:57:35 +00:00

LibPDF: Fix Destination formatting

This was not correctly written, and thus printed confusing output.
This commit is contained in:
Rodrigo Tobar 2023-01-06 00:31:53 +08:00 committed by Andreas Kling
parent b406f1d5a4
commit 2485c500a3

View file

@ -227,16 +227,16 @@ struct Formatter<PDF::Destination> : Formatter<FormatString> {
}
StringBuilder param_builder;
TRY(Formatter<FormatString>::format(builder, "{{ type={} page="sv, type_str));
if (destination.page.has_value())
TRY(builder.put_literal("{}"sv));
builder.builder().appendff("{{ type={} page="sv, type_str);
if (!destination.page.has_value())
TRY(builder.put_literal("{{}}"sv));
else
TRY(builder.put_u64(destination.page.value()));
for (auto& param : destination.parameters) {
TRY(builder.put_f64(double(param)));
TRY(builder.put_literal(" "sv));
}
return builder.put_literal("}}"sv);
return builder.put_literal(" }}"sv);
}
};