Explorar o código

Fixed bug into unmarshalList().

Fedorenko Dmitriy %!s(int64=11) %!d(string=hai) anos
pai
achega
a900174f0f
Modificáronse 1 ficheiros con 1 adicións e 3 borrados
  1. 1 3
      marshal.go

+ 1 - 3
marshal.go

@@ -952,10 +952,8 @@ func unmarshalList(info TypeInfo, data []byte, value interface{}) error {
 			if rv.Len() != n {
 				return unmarshalErrorf("unmarshal list: array with wrong size")
 			}
-		} else if rv.Cap() < n {
-			rv.Set(reflect.MakeSlice(t, n, n))
 		} else {
-			rv.SetLen(n)
+			rv.Set(reflect.MakeSlice(t, n, n))
 		}
 		for i := 0; i < n; i++ {
 			if len(data) < 2 {