Explorar o código

fix length calculation in bufferToBytesReader.WriteTo

Darien Raymond %!s(int64=8) %!d(string=hai) anos
pai
achega
2f5d501643
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      common/buf/reader.go

+ 1 - 1
common/buf/reader.go

@@ -73,10 +73,10 @@ func (r *bufferToBytesReader) writeToInternal(writer io.Writer) (int64, error) {
 	mbWriter := NewWriter(writer)
 	totalBytes := int64(0)
 	if r.leftOver != nil {
+		totalBytes += int64(r.leftOver.Len())
 		if err := mbWriter.Write(r.leftOver); err != nil {
 			return 0, err
 		}
-		totalBytes += int64(r.leftOver.Len())
 	}
 
 	for {