commit e46791d21b5e950e35a725e34cbee72354cc7d10
parent 6901b37194aa6d1314f8713e82ddf4e2a48dd40a
Author: Francois Parquet <francois.parquet@gmail.com>
Date: Sat, 30 Mar 2019 00:22:24 +0800
Merge pull request #107 from francoispqt/feature/improved-stream
Improve streaming
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/decode.go b/decode.go
@@ -344,6 +344,9 @@ func (dec *Decoder) read() bool {
// if we reach the end, double the buffer to ensure there's always more space
if len(dec.data) == dec.length {
nLen := dec.length * 2
+ if nLen == 0 {
+ nLen = 512
+ }
Buf := make([]byte, nLen, nLen)
copy(Buf, dec.data)
dec.data = Buf