mirror of
https://github.com/restic/restic.git
synced 2026-09-20 11:08:30 +00:00
check: Fix crash of --read-data-subset=x% on empty repository
Rounding up to at least one pack file should only be done if at least a pack file exists.
This commit is contained in:
@@ -331,7 +331,7 @@ func selectPacksByBucket(allPacks map[restic.ID]int64, bucket, totalBuckets uint
|
||||
func selectRandomPacksByPercentage(allPacks map[restic.ID]int64, percentage float64) map[restic.ID]int64 {
|
||||
packCount := len(allPacks)
|
||||
packsToCheck := int(float64(packCount) * (percentage / 100.0))
|
||||
if packsToCheck < 1 {
|
||||
if packCount > 0 && packsToCheck < 1 {
|
||||
packsToCheck = 1
|
||||
}
|
||||
timeNs := time.Now().UnixNano()
|
||||
|
||||
Reference in New Issue
Block a user