Skip to content

Commit

Permalink
Prevent error when socket client is disposed
Browse files Browse the repository at this point in the history
Close #1132
  • Loading branch information
veloce committed Nov 4, 2024
1 parent 5235661 commit 81ae8de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/src/model/game/game_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ class GameController extends _$GameController {
if (game.playable) {
_appLifecycleListener = AppLifecycleListener(
onResume: () {
if (_socketClient.isConnected) {
// socket client should never be disposed here, but in case it is
// we can safely skip the resync
if (!_socketClient.isDisposed && _socketClient.isConnected) {
_resyncGameData();
}
},
Expand Down

0 comments on commit 81ae8de

Please sign in to comment.