Skip to content

Commit

Permalink
fix: check interface value
Browse files Browse the repository at this point in the history
  • Loading branch information
shaun.fu committed Aug 28, 2023
1 parent 94722b6 commit 6633c2b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions get.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ func (e *ecp) getValue(config interface{}, keyName string) (reflect.Value, error
if !v.IsValid() {
return reflect.Value{}, fmt.Errorf("key %s not found", keyName)
}

if !v.CanInterface() {
return reflect.Value{}, fmt.Errorf("bad structure field %s", keyName)
}
return v, nil
}

Expand Down

0 comments on commit 6633c2b

Please sign in to comment.