Fix the NBT decoder return EOF if length equals to 0
This commit is contained in:
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user