Skip to content

Commit

Permalink
fix(ChannelManager): Avoid crash in remove method with uncached chann…
Browse files Browse the repository at this point in the history
…el (#4937)

* fix(ChannelManager): Avoid crash in remove method with uncached channel

* Use optional chaining

Co-authored-by: Ishmaam Khan <ishmaamk@gmail.com>

Co-authored-by: Ishmaam Khan <ishmaamk@gmail.com>
  • Loading branch information
AwesomeStickz and Ishmaam Khan committed Dec 12, 2020
1 parent bb78120 commit 12c909e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/managers/ChannelManager.js
Expand Up @@ -41,7 +41,7 @@ class ChannelManager extends BaseManager {

remove(id) {
const channel = this.cache.get(id);
if (channel.guild) channel.guild.channels.cache.delete(id);
channel?.guild?.channels.cache.delete(id);
this.cache.delete(id);
}

Expand Down

0 comments on commit 12c909e

Please sign in to comment.