Skip to content

Commit ad2afee

Browse files
Check user for nilness when computing defaultMode (#1356)
fixes #1354
1 parent 9aa428e commit ad2afee

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

model/user.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,10 @@ type DefaultModeSetting struct {
224224
Beta bool `json:"beta"`
225225
}
226226

227-
func (u User) GetDefaultMode() (DefaultModeSetting, error) {
227+
func (u *User) GetDefaultMode() (DefaultModeSetting, error) {
228+
if u == nil {
229+
return DefaultModeSetting{Beta: false}, nil
230+
}
228231
for _, setting := range u.Settings {
229232
if setting.Type == DefaultMode {
230233
var m DefaultModeSetting

0 commit comments

Comments
 (0)