Skip to content

Commit f51835f

Browse files
Copilotxsahil03x
andauthored
fix(ui): handle empty channel name in StreamChannelAvatar (#2487)
Co-authored-by: xsahil03x <25670178+xsahil03x@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Sahil Kumar <xdsahil@gmail.com>
1 parent 49ecf5a commit f51835f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/stream_chat_flutter/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Upcoming
2+
3+
🐞 Fixed
4+
5+
- Fixed `StreamChannelAvatar` crashing with `RangeError` when user/channel name is empty.
6+
17
## 9.22.0
28

39
✅ Added

packages/stream_chat_flutter/lib/src/channel/stream_channel_avatar.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class StreamChannelAvatar extends StatelessWidget {
108108

109109
final fallbackWidget = Center(
110110
child: Text(
111-
channel.name?[0] ?? '',
111+
channel.name?.characters.firstOrNull ?? '',
112112
style: TextStyle(
113113
color: colorTheme.barsBg,
114114
fontWeight: FontWeight.bold,

0 commit comments

Comments
 (0)