bencode: Can't get zero type of a nil interface
This commit is contained in:
parent
837bdd2ccf
commit
47a2453098
|
@ -181,7 +181,9 @@ func (e *encoder) reflect_value(v reflect.Value) {
|
||||||
e.reflect_value(v.Index(i))
|
e.reflect_value(v.Index(i))
|
||||||
}
|
}
|
||||||
e.write_string("e")
|
e.write_string("e")
|
||||||
case reflect.Interface, reflect.Ptr:
|
case reflect.Interface:
|
||||||
|
e.reflect_value(v.Elem())
|
||||||
|
case reflect.Ptr:
|
||||||
if v.IsNil() {
|
if v.IsNil() {
|
||||||
v = reflect.Zero(v.Type().Elem())
|
v = reflect.Zero(v.Type().Elem())
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue