Skip to content

Commit

Permalink
check assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
xujianhai666 committed Aug 6, 2019
1 parent c1868cc commit 9ebb613
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion object.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,11 @@ func (d *Decoder) decInstance(typ reflect.Type, cls classInfo) (interface{}, err
if err != nil {
return nil, perrors.Wrapf(err, "decInstance->Decode field name:%s", fieldName)
}
v := b.(bool)
v, ok := b.(bool)
if !ok {
return nil, perrors.Wrapf(err, "value convert to bool failed, field name:%s", fieldName)
}

if fldRawValue.Kind() == reflect.Ptr && fldRawValue.CanSet() {
if b != nil {
field.Set(reflect.ValueOf(&v))
Expand Down

0 comments on commit 9ebb613

Please sign in to comment.