1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-08-15 16:10:39 +03:00

Avoid NPE mentioned in #571: LoadFont with "bold" weight will crash

This commit is contained in:
Yuri Strot 2019-05-13 19:36:55 +07:00
parent 916240f118
commit 34d2382d93

View File

@ -58,7 +58,9 @@ class RenderUtils {
let lowerWeight = weight?.lowercased()
if lowerWeight == "bold" || lowerWeight == "bolder" {
#if os(iOS)
fontDesc = fontDesc.withSymbolicTraits(.traitBold)!
if let boldDesc = fontDesc.withSymbolicTraits(.traitBold) {
fontDesc = boldDesc
}
#elseif os(OSX)
fontDesc = fontDesc.withSymbolicTraits(.bold)
#endif