Browse Source

Merge pull request #42 from heidawei/issue_41

bugfix for issue 41
Pierre Curto 6 years ago
parent
commit
4b3a4429d1
1 changed files with 5 additions and 1 deletions
  1. 5 1
      writer.go

+ 5 - 1
writer.go

@@ -213,7 +213,11 @@ func (z *Writer) Flush() error {
 		return nil
 		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.
 // Close closes the Writer, flushing any unwritten data to the underlying io.Writer, but does not close the underlying io.Writer.