From 173695104ca3aae4299f0447adc3b7601ef6419c Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Mon, 23 May 2022 22:32:59 +0200 Subject: [PATCH] prune: Fix crash on empty snapshot --- cmd/restic/cmd_prune.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/restic/cmd_prune.go b/cmd/restic/cmd_prune.go index a6a8d0bde..d20d36544 100644 --- a/cmd/restic/cmd_prune.go +++ b/cmd/restic/cmd_prune.go @@ -596,10 +596,11 @@ func getUsedBlobs(gopts GlobalOptions, repo restic.Repository, ignoreSnapshots r Verbosef("loading all snapshots...\n") err = restic.ForAllSnapshots(gopts.ctx, repo.Backend(), repo, ignoreSnapshots, func(id restic.ID, sn *restic.Snapshot, err error) error { - debug.Log("add snapshot %v (tree %v, error %v)", id, *sn.Tree, err) if err != nil { + debug.Log("failed to load snapshot %v (error %v)", id, err) return err } + debug.Log("add snapshot %v (tree %v)", id, *sn.Tree) snapshotTrees = append(snapshotTrees, *sn.Tree) return nil })