Skip to content

Commit

Permalink
fix(ThreadManager): Fix internal crash upon conditionally resolving t…
Browse files Browse the repository at this point in the history
…hread members (#9648)

* fix(ThreadManager): Fix crash

* chore: prettier

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
cobaltt7 and kodiakhq[bot] authored Jun 14, 2023
1 parent 73c2f8a commit a6dbe16
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/discord.js/src/managers/ThreadManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ class ThreadManager extends CachedManager {
}, new Collection());

// Discord sends the thread id as id in this object
const threadMembers = rawThreads.members.reduce(
(coll, raw) => coll.set(raw.user_id, threads.get(raw.id).members._add(raw)),
new Collection(),
);
const threadMembers = rawThreads.members.reduce((coll, raw) => {
const thread = threads.get(raw.id);
return thread ? coll.set(raw.user_id, thread.members._add(raw)) : coll;
}, new Collection());

const response = { threads, members: threadMembers };

Expand Down

0 comments on commit a6dbe16

Please sign in to comment.