Sfoglia il codice sorgente

Merge pull request #42 from heidawei/issue_41

bugfix for issue 41
Pierre Curto 6 anni fa
parent
commit
4b3a4429d1
1 ha cambiato i file con 5 aggiunte e 1 eliminazioni
  1. 5 1
      writer.go

+ 5 - 1
writer.go

@@ -213,7 +213,11 @@ func (z *Writer) Flush() error {
 		return nil
 	}
 
-	return z.compressBlock(z.data[:z.idx])
+	if err := z.compressBlock(z.data[:z.idx]); err != nil {
+		return err
+	}
+	z.idx = 0
+	return nil
 }
 
 // Close closes the Writer, flushing any unwritten data to the underlying io.Writer, but does not close the underlying io.Writer.