bencode: Can't get zero type of a nil interface

This commit is contained in:
Matt Joiner 2015-10-23 12:37:30 +11:00
parent 837bdd2ccf
commit 47a2453098
1 changed files with 3 additions and 1 deletions

View File

@ -181,7 +181,9 @@ func (e *encoder) reflect_value(v reflect.Value) {
e.reflect_value(v.Index(i))
}
e.write_string("e")
case reflect.Interface, reflect.Ptr:
case reflect.Interface:
e.reflect_value(v.Elem())
case reflect.Ptr:
if v.IsNil() {
v = reflect.Zero(v.Type().Elem())
} else {