do nothing if connection not provided

This commit is contained in:
liamcottle
2025-02-13 14:51:39 +13:00
parent 8885f65850
commit b93f0ef9f5

View File

@@ -48,9 +48,17 @@ class Connection {
} }
static async connect(connection) { static async connect(connection) {
// do nothing if connection not provided
if(!connection){
return;
}
// update connection and listen for events
GlobalState.connection = connection; GlobalState.connection = connection;
GlobalState.connection.on("connected", () => this.onConnected()); GlobalState.connection.on("connected", () => this.onConnected());
GlobalState.connection.on("disconnected", () => this.onDisconnected()); GlobalState.connection.on("disconnected", () => this.onDisconnected());
} }
static async disconnect() { static async disconnect() {