From b2ed5d2f6bcf4e7cfb824baae7089b7d56c56244 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Fri, 23 Apr 2021 11:47:08 +1000 Subject: [PATCH] Ensure session is available for disconnect --- src/network/Session.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/network/Session.js b/src/network/Session.js index b2973cc..b646708 100644 --- a/src/network/Session.js +++ b/src/network/Session.js @@ -111,7 +111,7 @@ class Session extends EventEmitter { } disconnect() { - this.socket.disconnect(); + this.socket?.disconnect(); } /** @@ -198,7 +198,12 @@ class Session extends EventEmitter { this._gameId = gameId; this._password = password; - this.socket.emit("join_game", gameId, password, process.env.REACT_APP_VERSION); + this.socket.emit( + "join_game", + gameId, + password, + process.env.REACT_APP_VERSION + ); this.emit("status", "joining"); }