From 356d2ddfa843a83ba8da1e58f347a9d22cfef8ad Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Sat, 11 Nov 2023 15:16:17 -0800 Subject: [PATCH] Null pointer exception fixes --- pkg/logging.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/logging.go b/pkg/logging.go index fbd1252..cefd316 100644 --- a/pkg/logging.go +++ b/pkg/logging.go @@ -14,7 +14,7 @@ import ( // IsLoggingUsername checks whether the app is currently configured to log a user's DMs. func IsLoggingUsername(sub *Subscriber) bool { - if !config.Current.Logging.Enabled { + if !config.Current.Logging.Enabled || sub == nil { return false } @@ -49,7 +49,7 @@ func IsLoggingChannel(channel string) bool { // LogMessage appends to a user's conversation log. func LogMessage(sub *Subscriber, otherUsername, senderUsername string, msg messages.Message) { - if !sub.log { + if sub == nil || !sub.log { return }