Null pointer exception fixes

This commit is contained in:
Noah 2023-11-11 15:16:17 -08:00
parent f0a6585af1
commit 356d2ddfa8

View File

@ -14,7 +14,7 @@ import (
// IsLoggingUsername checks whether the app is currently configured to log a user's DMs. // IsLoggingUsername checks whether the app is currently configured to log a user's DMs.
func IsLoggingUsername(sub *Subscriber) bool { func IsLoggingUsername(sub *Subscriber) bool {
if !config.Current.Logging.Enabled { if !config.Current.Logging.Enabled || sub == nil {
return false return false
} }
@ -49,7 +49,7 @@ func IsLoggingChannel(channel string) bool {
// LogMessage appends to a user's conversation log. // LogMessage appends to a user's conversation log.
func LogMessage(sub *Subscriber, otherUsername, senderUsername string, msg messages.Message) { func LogMessage(sub *Subscriber, otherUsername, senderUsername string, msg messages.Message) {
if !sub.log { if sub == nil || !sub.log {
return return
} }