Skip to content

Commit

Permalink
Check user for nilness when computing defaultMode (#1356)
Browse files Browse the repository at this point in the history
fixes #1354
  • Loading branch information
joschahenningsen authored May 8, 2024
1 parent 9aa428e commit ad2afee
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion model/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ad2afee

Please sign in to comment.