Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from Dec 12, 2020

Conversation

AwesomeStickz
Copy link
Contributor

@AwesomeStickz AwesomeStickz commented Oct 25, 2020

Please describe the changes this PR makes and why it should be merged:
When the bot leaves a guild, actions/GuildDelete calls ChannelManager.remove from a list of channels which removes the channel from the cache. When it comes to a channel that is not in the cache, it crashes the process. This PR fixes that issue

Status

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

Semantic versioning classification:

  • This PR changes the library's interface (methods or parameters added)
    • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)
  • This PR only includes non-code changes, like changes to documentation, README, etc.

Copy link
Contributor

@Extroonie Extroonie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As #5067 has been merged, you can safely make use of optional chaining.

src/managers/ChannelManager.js Outdated Show resolved Hide resolved
AwesomeStickz and others added 2 commits December 10, 2020 21:47
Co-authored-by: Ishmaam Khan <ishmaamk@gmail.com>
@iCrawl iCrawl merged commit 12c909e into discordjs:master Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants