Skip to content

Commit 46c632d

Browse files
authored
Fix crash when using font that does not support bold or italic trait (#976)
* Fix crash when using font that does not support bold trait * Update CHANGELOG with bug fix for font crash Added a fix for a crash related to unsupported bold fonts. * Update CHANGELOG.md * Clarify font trait support in changelog entry Updated the changelog entry for issue #976 to clarify the font trait support.
1 parent 3895749 commit 46c632d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
55

66
### 🐞 Fixed
77
- Fix openChannel not working when searching or another chat shown [#975](https://github.com/GetStream/stream-chat-swiftui/pull/975)
8+
- Fix crash when using a font that does not support bold or italic trait [#976](https://github.com/GetStream/stream-chat-swiftui/pull/976)
89

910
# [4.89.1](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.89.1)
1011
_September 23, 2025_

Sources/StreamChatSwiftUI/Utils/Common/UIFont+Extensions.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import UIKit
66

77
extension UIFont {
88
func withTraits(traits: UIFontDescriptor.SymbolicTraits) -> UIFont {
9-
let descriptor = fontDescriptor.withSymbolicTraits(traits)
10-
return UIFont(descriptor: descriptor!, size: pointSize)
9+
guard let descriptor = fontDescriptor.withSymbolicTraits(traits) else {
10+
return self
11+
}
12+
return UIFont(descriptor: descriptor, size: pointSize)
1113
}
1214

1315
var bold: UIFont {

0 commit comments

Comments
 (0)