diff --git a/src/duplicacy_snapshotmanager.go b/src/duplicacy_snapshotmanager.go index 9d1d4bc..28ddc58 100644 --- a/src/duplicacy_snapshotmanager.go +++ b/src/duplicacy_snapshotmanager.go @@ -448,7 +448,7 @@ func (manager *SnapshotManager) CleanSnapshotCache(latestSnapshot *Snapshot, all allFiles, _ := manager.ListAllFiles(manager.snapshotCache, chunkDir) for _, file := range allFiles { - if file[len(file)-1] != '/' { + if len(file) > 0 && file[len(file)-1] != '/' { chunkID := strings.Replace(file, "/", "", -1) if _, found := chunks[chunkID]; !found { LOG_DEBUG("SNAPSHOT_CLEAN", "Delete chunk %s from the snapshot cache", chunkID) @@ -2428,7 +2428,7 @@ func (manager *SnapshotManager) pruneSnapshotsExhaustive(referencedFossils map[s allFiles, _ := manager.ListAllFiles(manager.storage, chunkDir) for _, file := range allFiles { - if file[len(file)-1] == '/' { + if len(file) == 0 || file[len(file)-1] == '/' { continue }