Fix the NBT decoder return EOF if length equals to 0

This commit is contained in:
Tnze
2019-07-24 15:29:10 +08:00
parent d9098676fd
commit e5c32df53b

View File

@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"errors" "errors"
"fmt" "fmt"
"io"
"math" "math"
"reflect" "reflect"
) )
@ -402,7 +403,8 @@ func (d *Decoder) readNByte(n int) (buf []byte, err error) {
} }
buf = make([]byte, n) buf = make([]byte, n)
_, err = d.r.Read(buf) //what happened if (returned n) != (argument n) ? _, err = io.ReadFull(d.r, buf)
return return
} }