From b2a49fae3cbb5332f6b6ffd632f472e2513d00d8 Mon Sep 17 00:00:00 2001 From: Mihai <45673304+mihaicm93@users.noreply.github.com> Date: Tue, 3 Mar 2026 05:17:03 +0100 Subject: [PATCH] Fix/server deletion lockup (#134) * fix: Server deletion client lockup Signed-off-by: mihai <45673304+mihaicm93@users.noreply.github.com> * fix: lint errors Signed-off-by: mihai <45673304+mihaicm93@users.noreply.github.com> * fix lint error Signed-off-by: mihai <45673304+mihaicm93@users.noreply.github.com> --------- Signed-off-by: mihai <45673304+mihaicm93@users.noreply.github.com> Co-authored-by: Christopher Hultin --- src/classes/Server.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/classes/Server.ts b/src/classes/Server.ts index 72218942..a63d6e25 100644 --- a/src/classes/Server.ts +++ b/src/classes/Server.ts @@ -136,9 +136,10 @@ export class Server { * Channels */ get channels(): Channel[] { - return [ - ...this.#collection.getUnderlyingObject(this.id).channelIds.values(), - ] + const channelIds = this.#collection.getUnderlyingObject(this.id).channelIds; + if (!channelIds) return []; + + return [...channelIds.values()] .map((id) => this.#collection.client.channels.get(id)!) .filter((x) => x); } @@ -338,6 +339,7 @@ export class Server { * Permission the currently authenticated user has against this server */ get permission(): bigint { + if (!this.$exists) return 0n; return calculatePermission(this.#collection.client, this); }