DecompressedStream: fix endless loop
authorHelmut Grohne <helmut@subdivi.de>
Wed, 29 Dec 2021 21:14:50 +0000 (22:14 +0100)
committerHelmut Grohne <helmut@subdivi.de>
Wed, 29 Dec 2021 21:14:50 +0000 (22:14 +0100)
Fixes: 775bdde52ad5 ("DecompressedStream: avoid mixing types for variable data")

dedup/compression.py

index 9cd63e5..6d361ac 100644 (file)
@@ -110,8 +110,9 @@ class DecompressedStream:
             data = self.fileobj.read(self.blocksize)
             if data:
                 self.buff += self.decompressor.decompress(data)
-            elif hasattr(self.decompressor, "flush"):
-                self.buff += self.decompressor.flush()
+            else:
+                if hasattr(self.decompressor, "flush"):
+                    self.buff += self.decompressor.flush()
                 break
 
     def _read_from_buff(self, length):