From d398449326a3da31ef995b9174af4af40c8cc18e Mon Sep 17 00:00:00 2001 From: Daniel Bereza Date: Tue, 21 Jun 2022 15:27:54 -0700 Subject: [PATCH] Fixes NullRef in LogDelete --- src/BotCatMaxy/Services/Logging/LoggingHandler.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/BotCatMaxy/Services/Logging/LoggingHandler.cs b/src/BotCatMaxy/Services/Logging/LoggingHandler.cs index db27a4a..5cef3de 100644 --- a/src/BotCatMaxy/Services/Logging/LoggingHandler.cs +++ b/src/BotCatMaxy/Services/Logging/LoggingHandler.cs @@ -121,21 +121,20 @@ private async Task LogDelete(Cacheable message, Cacheable(); - - if (settings.channelLogBlacklist.Contains(channel.Id)) + LogSettings settings = guild.LoadFromFile(false); + if (settings?.channelLogBlacklist != null && settings.channelLogBlacklist.Contains(channel.Id)) return; + await DiscordLogging.LogMessage("Deleted message", message.GetOrDownloadAsync().Result); } catch (Exception exception) { - await new LogMessage(LogSeverity.Error, "Logging", "Error", exception).Log(); + LogSeverity.Error.LogException("Logging", "Error logging deleted message", exception); } - //Console.WriteLine(new LogMessage(LogSeverity.Info, "Logging", "Message deleted")); } } \ No newline at end of file