From 5ef24e9c24c65fbe7ab0cff0cce44bf8f7815d18 Mon Sep 17 00:00:00 2001 From: lukasIO Date: Mon, 9 Dec 2024 17:58:32 +0100 Subject: [PATCH] Prevent undefined access to engine in connection reconciler (#1349) * Prevent undefined access to engine in connection reconciler * Create red-maps-happen.md * also transports * set engine undefined if it's undefined2 --- .changeset/red-maps-happen.md | 5 +++++ src/room/Room.ts | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 .changeset/red-maps-happen.md diff --git a/.changeset/red-maps-happen.md b/.changeset/red-maps-happen.md new file mode 100644 index 0000000000..a21108df2a --- /dev/null +++ b/.changeset/red-maps-happen.md @@ -0,0 +1,5 @@ +--- +"livekit-client": patch +--- + +Prevent undefined access to engine in connection reconciler diff --git a/src/room/Room.ts b/src/room/Room.ts index 6319d1768d..effcb84a64 100644 --- a/src/room/Room.ts +++ b/src/room/Room.ts @@ -1903,10 +1903,12 @@ class Room extends (EventEmitter as new () => TypedEmitter) this.log.warn('detected connection state mismatch', { ...this.logContext, numFailures: consecutiveFailures, - engine: { - closed: this.engine.isClosed, - transportsConnected: this.engine.verifyTransport(), - }, + engine: this.engine + ? { + closed: this.engine.isClosed, + transportsConnected: this.engine.verifyTransport(), + } + : undefined, }); if (consecutiveFailures >= 3) { this.recreateEngine();