Skip to content

Crash in CDFont+CDMarkdownKit.swift, line 57. Unexpectedly found nil when unwrapping optional value. #34

@mathist

Description

@mathist

What did you do?

                        if let m = chat.message
                           , let font = UIFont(name: "Lato-Regular", size: 20.0)
                        {   
                            let markdownParser = CDMarkdownParser(font: font)
                        }

What did you expect to happen?

No crash

What happened instead?

Crash in CDFont+CDMarkdownKit.swift, line 57. Unexpectedly found nil when unwrapping optional value.

CDMarkdownKit Environment

CDMarkdownKit v2.1.1
xcode 12.5.1
swift v5.0
iOS Simulator
macOS 11.4

This is the CDMarkdownKit code that crashed, it crashed on the force unwrap of "descriptor" variable.

private func withTraits(_ traits: CDFontDescriptorSymbolicTraits...) -> CDFont {
    let descriptor = fontDescriptor.withSymbolicTraits(CDFontDescriptorSymbolicTraits(traits))
    return CDFont(descriptor: descriptor!,
                  size: self.pointSize)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions