瀏覽代碼

Fix missing FChunkStarted check in EndChunk.

This was causing an extra empty stream to be written after every chunk (each 2 bytes, with lzma2).
Jordan Russell 10 月之前
父節點
當前提交
86eeba3d8a
共有 1 個文件被更改,包括 9 次插入9 次删除
  1. 9 9
      Projects/Src/Compiler.CompressionHandler.pas

+ 9 - 9
Projects/Src/Compiler.CompressionHandler.pas

@@ -231,15 +231,15 @@ end;
 
 procedure TCompressionHandler.EndChunk;
 begin
-  if Assigned(FCompressor) then begin
-    FCompressor.Finish;
-    { In case we didn't get a ProgressProc call after the final block: }
-    FCompiler.SetBytesCompressedSoFar(FInitialBytesCompressedSoFar);
-    FCompiler.AddBytesCompressedSoFar(FChunkBytesRead);
-    FCompiler.CallIdleProc;
-  end;
-
+  if not FChunkStarted then
+    Exit;
   FChunkStarted := False;
+
+  FCompressor.Finish;
+  { In case we didn't get a ProgressProc call after the final block: }
+  FCompiler.SetBytesCompressedSoFar(FInitialBytesCompressedSoFar);
+  FCompiler.AddBytesCompressedSoFar(FChunkBytesRead);
+  FCompiler.CallIdleProc;
 end;
 
 procedure TCompressionHandler.CompressFile(const SourceFile: TFile;
@@ -315,4 +315,4 @@ begin
   FCompiler.CallIdleProc;
 end;
 
-end.
+end.