Skip to content

Commit

Permalink
Yaml: handle type error due to invalid content (#14964)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored Jul 22, 2024
1 parent 5d540f6 commit 5083645
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/db/settings/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"cmp"
"encoding/json"
"errors"
"fmt"
"io"
"reflect"
"slices"
Expand Down Expand Up @@ -200,7 +201,7 @@ func DecodeOtherSliceOrMap(other, res any) error {
if typ := reflect.TypeOf(other); typ.Kind() == reflect.Slice || typ.Kind() == reflect.Map {
len = reflect.ValueOf(other).Len()
} else {
panic("invalid kind: " + typ.Kind().String())
return fmt.Errorf("cannot decode into slice or map: %v", other)
}

if len == 0 {
Expand Down

0 comments on commit 5083645

Please sign in to comment.