Skip to content

Commit

Permalink
Fix bad type check
Browse files Browse the repository at this point in the history
Fixes an NRE thrown when an automatic warning is issued for the starting message in a forum post
  • Loading branch information
FloatingMilkshake committed Dec 26, 2024
1 parent a77eeaa commit 8139986
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Helpers/WarningHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ public static async Task<DiscordMessage> SendPublicWarningMessageAndDeleteInfrin
// Return the sent warning message for logging.

var targetChannel = infringingMessage.Channel;
if (infringingMessage.Channel.Type == DiscordChannelType.GuildForum)
if (infringingMessage.Channel.Type == DiscordChannelType.GuildForum || infringingMessage.Channel.Parent.Type == DiscordChannelType.GuildForum)
{
if (Program.cfgjson.ForumChannelAutoWarnFallbackChannel == 0)
Program.discord.Logger.LogWarning("A warning in forum channel {channelId} was attempted, but may fail due to the fallback channel not being set. Please set 'forumChannelAutoWarnFallbackChannel' in config.json to avoid this.", targetChannel.Id);
Expand Down

0 comments on commit 8139986

Please sign in to comment.