From 5a7641b4d6af5834ca71ba1f18c1fc341ce34f1d Mon Sep 17 00:00:00 2001 From: Shibo Lyu <hi@lao.sb> Date: Wed, 2 Apr 2025 00:30:10 +0800 Subject: [PATCH] fix: check null encodedKeyPair in onKeyPairChange --- src/lib/chatServers.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/chatServers.ts b/src/lib/chatServers.ts index 8bcb4bd..2ae48c5 100644 --- a/src/lib/chatServers.ts +++ b/src/lib/chatServers.ts @@ -52,8 +52,8 @@ class ChatServerConnectionPool { this.connections.clear(); } - private async onKeyPairChange(encodedKeyPair: EncodedBlahKeyPair) { - this.keypair = await BlahKeyPair.fromEncoded(encodedKeyPair); + private async onKeyPairChange(encodedKeyPair: EncodedBlahKeyPair | null) { + this.keypair = encodedKeyPair ? await BlahKeyPair.fromEncoded(encodedKeyPair) : null; for (const connection of this.connections.values()) { connection.changeKeyPair(this.keypair); connection.connect();