Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(doc): fix some code error (#5489)

VicKun674fd6ebe8e1
diff --git a/packages/engine-render/src/components/docs/layout/tools.ts b/packages/engine-render/src/components/docs/layout/tools.ts
index a4920abb9e..d3bb483857 100644
--- a/packages/engine-render/src/components/docs/layout/tools.ts
+++ b/packages/engine-render/src/components/docs/layout/tools.ts
@@ -482,11 +482,13 @@ export function updateInlineDrawingCoordsAndBorder(ctx: ILayoutContext, pages: I
}
const paragraphStyle = paragraphConfig?.paragraphStyle;
- const lastDivide = line.divides[line.divides.length - 1];
- const lastGlyph = lastDivide.glyphGroup[lastDivide.glyphGroup.length - 1];
+ if (line.divides.length > 0) {
+ const lastDivide = line.divides[line.divides.length - 1];
+ const lastGlyph = lastDivide.glyphGroup[lastDivide.glyphGroup.length - 1];
- if (lastGlyph.streamType === DataStreamTreeTokenType.PARAGRAPH && paragraphStyle?.borderBottom) {
- line.borderBottom = paragraphStyle.borderBottom;
+ if (lastGlyph.streamType === DataStreamTreeTokenType.PARAGRAPH && paragraphStyle?.borderBottom) {
+ line.borderBottom = paragraphStyle.borderBottom;
+ }
}
});
}