2
0
mirror of synced 2025-02-23 22:28:11 +00:00

Decoding bools has been wrong all along, always set to true

This commit is contained in:
Matt Joiner 2014-12-01 23:28:47 -06:00
parent 543d0e72a9
commit 916c9c822a

View File

@ -113,10 +113,7 @@ func (d *decoder) parse_int(v reflect.Value) {
}
v.SetUint(n)
case reflect.Bool:
if d.buf.Len() == 1 && d.buf.Bytes()[0] == '0' {
v.SetBool(false)
}
v.SetBool(true)
v.SetBool(d.buf.String() != "0")
default:
panic(&UnmarshalTypeError{
Value: "integer " + d.buf.String(),