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(GuildAuditLog): Assert target to null upon not finding invite codes #6171

Merged
merged 1 commit into from Jul 23, 2021
Merged

fix(GuildAuditLog): Assert target to null upon not finding invite codes #6171

merged 1 commit into from Jul 23, 2021

Conversation

Jiralite
Copy link
Member

@Jiralite Jiralite commented Jul 22, 2021

Please describe the changes this PR makes and why it should be merged:
Hi there!

Upon running <Guild>.fetchAuditLogs({ type }) where type is 40 (INVITE_CREATE), 41 (INVITE_UPDATE) or 42 (INVITE_DELETE), there is a possibility that target on the returned GuildAuditLogsEntry will be undefined.

One case where this is easily reproducible is by simply creating and then deleting an invite and then running <Guild>.fetchAuditLogs({ type: 40 }).

I've simply added the nullish coalescing operator after that check to ensure that if an invite code cannot be found, it will default to null and not undefined.

Status and versioning classification:

  • 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

@iCrawl iCrawl merged commit c8ca7bf into discordjs:master Jul 23, 2021
@Jiralite Jiralite deleted the patch-1 branch July 23, 2021 00:26
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

4 participants