Skip to content

Commit b2a49fa

Browse files
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 <chris.hultin@gmail.com>
1 parent 7cdf5b1 commit b2a49fa

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/classes/Server.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,10 @@ export class Server {
136136
* Channels
137137
*/
138138
get channels(): Channel[] {
139-
return [
140-
...this.#collection.getUnderlyingObject(this.id).channelIds.values(),
141-
]
139+
const channelIds = this.#collection.getUnderlyingObject(this.id).channelIds;
140+
if (!channelIds) return [];
141+
142+
return [...channelIds.values()]
142143
.map((id) => this.#collection.client.channels.get(id)!)
143144
.filter((x) => x);
144145
}
@@ -338,6 +339,7 @@ export class Server {
338339
* Permission the currently authenticated user has against this server
339340
*/
340341
get permission(): bigint {
342+
if (!this.$exists) return 0n;
341343
return calculatePermission(this.#collection.client, this);
342344
}
343345

0 commit comments

Comments
 (0)