Add a check to make sure that the player's socket also isn't undefined
This commit is contained in:
parent
f4396a1c42
commit
330125efbe
1 changed files with 1 additions and 1 deletions
|
|
@ -20,7 +20,7 @@ export class Player {
|
|||
/** The socket that can be used to communicate directly with the player */
|
||||
get socket() { return this._socket };
|
||||
set socket(value: Socket) {
|
||||
if (!this._socket.connected) {
|
||||
if (!this._socket?.connected) {
|
||||
this._socket = value;
|
||||
} else {
|
||||
throw Error("Cannot overwrite a player's socket that is connected.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue