Skip to content

Commit

Permalink
Don't use null check operator on potentially nil value in ConnectionC…
Browse files Browse the repository at this point in the history
…lose message

This commit attempts to fix issue #104 by using a ?? operator to avoid
raising a _CastError if a ConnectionClose message does not include a
replyText field.
  • Loading branch information
achilleasa committed Aug 15, 2023
1 parent 4e2a811 commit 39baef3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/client/impl/client_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class _ClientImpl implements Client {
ConnectionClose serverResponse =
(serverMessage.message as ConnectionClose);
throw ConnectionException(
serverResponse.replyText!,
serverResponse.replyText ?? "Server closed the connection",
ErrorType.valueOf(serverResponse.replyCode),
serverResponse.msgClassId,
serverResponse.msgMethodId);
Expand Down

0 comments on commit 39baef3

Please sign in to comment.