Explorar o código

Merge pull request #7036 from ThomasWaldmann/fix-7034-master

check: fix uninitialised variable if repo is completely empty, fixes #7034
TW %!s(int64=3) %!d(string=hai) anos
pai
achega
7e3b6752cb
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      src/borg/repository.py

+ 1 - 0
src/borg/repository.py

@@ -1081,6 +1081,7 @@ class Repository:
         pi = ProgressIndicatorPercent(
             total=segment_count, msg="Checking segments %3.1f%%", step=0.1, msgid="repository.check"
         )
+        segment = -1  # avoid uninitialized variable if there are no segment files at all
         for i, (segment, filename) in enumerate(self.io.segment_iterator()):
             pi.show(i)
             if segment <= last_segment_checked: