Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

fix(pdf): avoid toReversed in icon size resolution (#3129)

Lihan YANGe00ff8ceca3e
diff --git a/packages/pdf/src/templates/shared/icon-size.ts b/packages/pdf/src/templates/shared/icon-size.ts
index 8929934ff..16ab5a2cf 100644
--- a/packages/pdf/src/templates/shared/icon-size.ts
+++ b/packages/pdf/src/templates/shared/icon-size.ts
@@ -17,7 +17,12 @@ export const parseStyleFontSize = (fontSize: Style["fontSize"] | undefined): num
export const resolveStyleFontSize = (...styles: StyleInput[]): number | undefined => {
for (let index = styles.length - 1; index >= 0; index -= 1) {
- for (const style of composeStyles(styles[index]).toReversed()) {
+ const composedStyles = composeStyles(styles[index]);
+
+ for (let styleIndex = composedStyles.length - 1; styleIndex >= 0; styleIndex -= 1) {
+ const style = composedStyles[styleIndex];
+ if (style === undefined) continue;
+
const fontSize = parseStyleFontSize(style.fontSize);
if (fontSize !== undefined) return fontSize;
}