From ad2afeee6e4821f8be8ba011441c0153395a02d9 Mon Sep 17 00:00:00 2001 From: Joscha Henningsen <44805696+joschahenningsen@users.noreply.github.com> Date: Wed, 8 May 2024 23:16:01 +0200 Subject: [PATCH] Check user for nilness when computing defaultMode (#1356) fixes #1354 --- model/user.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/model/user.go b/model/user.go index e0e6fc25f..04be99a44 100755 --- a/model/user.go +++ b/model/user.go @@ -224,7 +224,10 @@ type DefaultModeSetting struct { Beta bool `json:"beta"` } -func (u User) GetDefaultMode() (DefaultModeSetting, error) { +func (u *User) GetDefaultMode() (DefaultModeSetting, error) { + if u == nil { + return DefaultModeSetting{Beta: false}, nil + } for _, setting := range u.Settings { if setting.Type == DefaultMode { var m DefaultModeSetting