From 7edf0fdb93931737d1cff649a8a6e407c710306d Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 12 Aug 2021 21:03:11 -0400 Subject: [PATCH] Fix crash when replying to post with preformatted text --- Tusker/Views/ContentTextView.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tusker/Views/ContentTextView.swift b/Tusker/Views/ContentTextView.swift index 18425743..5f86f999 100644 --- a/Tusker/Views/ContentTextView.swift +++ b/Tusker/Views/ContentTextView.swift @@ -143,9 +143,9 @@ class ContentTextView: LinkTextView { case "del": attributed.addAttribute(.strikethroughStyle, value: NSUnderlineStyle.single.rawValue, range: attributed.fullRange) case "code": - attributed.addAttribute(.font, value: UIFont.monospacedSystemFont(ofSize: self.font!.pointSize, weight: .regular), range: attributed.fullRange) + attributed.addAttribute(.font, value: UIFont.monospacedSystemFont(ofSize: defaultFont.pointSize, weight: .regular), range: attributed.fullRange) case "pre": - attributed.addAttribute(.font, value: UIFont.monospacedSystemFont(ofSize: self.font!.pointSize, weight: .regular), range: attributed.fullRange) + attributed.addAttribute(.font, value: UIFont.monospacedSystemFont(ofSize: defaultFont.pointSize, weight: .regular), range: attributed.fullRange) attributed.append(NSAttributedString(string: "\n\n")) case "ol", "ul": attributed.trimLeadingCharactersInSet(.whitespacesAndNewlines) @@ -157,7 +157,7 @@ class ContentTextView: LinkTextView { if parentTag == "ol" { let index = (try? node.elementSiblingIndex()) ?? 0 // we use the monospace digit font so that the periods of all the list items line up - bullet = NSAttributedString(string: "\(index + 1).\t", attributes: [.font: UIFont.monospacedDigitSystemFont(ofSize: self.font!.pointSize, weight: .regular)]) + bullet = NSAttributedString(string: "\(index + 1).\t", attributes: [.font: UIFont.monospacedDigitSystemFont(ofSize: defaultFont.pointSize, weight: .regular)]) } else if parentTag == "ul" { bullet = NSAttributedString(string: "\u{2022}\t") } else {