Browse Source

Fixed bug into unmarshalList().

Fedorenko Dmitriy 11 years ago
parent
commit
a900174f0f
1 changed files with 1 additions and 3 deletions
  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 {