Skip to content

Commit f4ee46b

Browse files
authored
fix(llc): null check on websocket connection (#2260)
1 parent ec653d0 commit f4ee46b

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

packages/stream_chat/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
- Deprecated `message.reactionCounts`, `message.reactionScores` in favor of
1212
`message.reactionGroups`.
1313

14+
🐞 Fixed
15+
- `Null check operator used on a null value` in Websocket connect.
16+
1417
## 9.10.0
1518

1619
🐞 Fixed

packages/stream_chat/lib/src/ws/websocket.dart

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ class WebSocket with TimerHelper {
210210
Future<Event> connect(
211211
User user, {
212212
bool includeUserDetails = false,
213-
}) async {
213+
}) {
214214
if (_connectRequestInProgress) {
215215
throw const StreamWebSocketError('''
216216
You've called connect twice,
@@ -222,8 +222,17 @@ class WebSocket with TimerHelper {
222222

223223
_user = user;
224224
_connectionStatus = ConnectionStatus.connecting;
225+
225226
connectionCompleter = Completer<Event>();
226227

228+
_setupConnection(includeUserDetails: includeUserDetails);
229+
230+
return connectionCompleter!.future;
231+
}
232+
233+
Future<void> _setupConnection({
234+
required bool includeUserDetails,
235+
}) async {
227236
try {
228237
final uri = await _buildUri(
229238
includeUserDetails: includeUserDetails,
@@ -233,8 +242,6 @@ class WebSocket with TimerHelper {
233242
} catch (e, stk) {
234243
_onConnectionError(e, stk);
235244
}
236-
237-
return connectionCompleter!.future;
238245
}
239246

240247
int _reconnectAttempt = 0;

0 commit comments

Comments
 (0)