Review 371e60b17c and apply fixes

This commit is contained in:
Zahary Karadjov 2022-01-22 16:19:56 +02:00
commit 94fa3fab8c
2 changed files with 6 additions and 7 deletions

View file

@ -808,13 +808,10 @@ template readIntoExImpl(s: InputStream,
let totalBytesDrained = drainBuffersInto(s, dst, dstLen)
var bytesDeficit = (dstLen - totalBytesDrained)
if bytesDeficit > 0:
if bytesDeficit > 0 and s.vtable != nil:
var adjustedDst = offset(dst, totalBytesDrained)
while true:
if s.vtable.isNil():
break
let newBytesRead = awaiter s.vtable.readOp(s, adjustedDst, bytesDeficit)
s.spanEndPos += newBytesRead