From 79ec6ef9ec0a413cd72f243b89588315ae0c0b9f Mon Sep 17 00:00:00 2001 From: Michael Griebling Date: Mon, 16 Jan 2023 15:00:35 -0500 Subject: [PATCH] Fixed color setting crash. --- .../SwiftMathRender/MathRender/MTMathListDisplay.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Sources/SwiftMathRender/MathRender/MTMathListDisplay.swift b/Sources/SwiftMathRender/MathRender/MTMathListDisplay.swift index 40c03bc..2195385 100644 --- a/Sources/SwiftMathRender/MathRender/MTMathListDisplay.swift +++ b/Sources/SwiftMathRender/MathRender/MTMathListDisplay.swift @@ -328,11 +328,13 @@ class MTFractionDisplay : MTDisplay { } func updateDenominatorPosition() { - denominator?.position = CGPointMake(self.position.x + (self.width - denominator!.width)/2, self.position.y - self.denominatorDown) + guard denominator != nil else { return } + denominator!.position = CGPointMake(self.position.x + (self.width - denominator!.width)/2, self.position.y - self.denominatorDown) } func updateNumeratorPosition() { - numerator?.position = CGPointMake(self.position.x + (self.width - numerator!.width)/2, self.position.y + self.numeratorUp) + guard numerator != nil else { return } + numerator!.position = CGPointMake(self.position.x + (self.width - numerator!.width)/2, self.position.y + self.numeratorUp) } override var position: CGPoint { @@ -399,8 +401,8 @@ class MTRadicalDisplay : MTDisplay { override var textColor: MTColor? { set { super.textColor = newValue - self.radicand!.textColor = newValue - self.degree!.textColor = newValue + self.radicand?.textColor = newValue + self.degree?.textColor = newValue } get { super.textColor } }