From cfd646dcac0c5553e21ebf1ee05f9078277518bc Mon Sep 17 00:00:00 2001 From: Lakr Date: Thu, 3 Jul 2025 15:13:23 +0900 Subject: [PATCH] Fix spacer insertion condition in table cell loop Changed the condition to insert a spacer only when a table row has at least two cells, preventing out-of-bounds errors when accessing the second cell. --- Sources/SwiftMath/MathRender/MTMathAtomFactory.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/SwiftMath/MathRender/MTMathAtomFactory.swift b/Sources/SwiftMath/MathRender/MTMathAtomFactory.swift index c69fca9..5109fca 100755 --- a/Sources/SwiftMath/MathRender/MTMathAtomFactory.swift +++ b/Sources/SwiftMath/MathRender/MTMathAtomFactory.swift @@ -848,7 +848,7 @@ public class MTMathAtomFactory { let spacer = MTMathAtom(type: .ordinary, value: "") for i in 0..= 1 { + if table.cells[i].count >= 2 { table.cells[i][1].insert(spacer, at: 0) } }