From 1311add1830bb11457059d9f0e75a488440a6949 Mon Sep 17 00:00:00 2001 From: senolem <37041587+senolem@users.noreply.github.com> Date: Thu, 25 Jan 2024 20:42:30 +0100 Subject: [PATCH] Checking if either roomId or token is null when splitting the reconnectionToken, meaning that the reconnectionToken format is invalid --- src/Client.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Client.ts b/src/Client.ts index 9c8401b..917ae17 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -100,6 +100,9 @@ export class Client { throw new Error("DEPRECATED: .reconnect() now only accepts 'reconnectionToken' as argument.\nYou can get this token from previously connected `room.reconnectionToken`"); } const [roomId, token] = reconnectionToken.split(":"); + if (!roomId || !token) { + throw new Error("Invalid reconnection token format.\nThe format should be roomId:reconnectionToken"); + } return await this.createMatchMakeRequest('reconnect', roomId, { reconnectionToken: token }, rootSchema); }