1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2025-01-03 13:45:20 +00:00

Merge pull request #3270 from restic/fix-ls-json

ls: Check for non-nil error before calling panic()
This commit is contained in:
MichaelEischer 2021-02-09 22:05:04 +01:00 committed by GitHub
commit 917f5b910a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -165,7 +165,9 @@ func runLs(opts LsOptions, gopts GlobalOptions, args []string) error {
ShortID: sn.ID().Str(), ShortID: sn.ID().Str(),
StructType: "snapshot", StructType: "snapshot",
}) })
panic(err) if err != nil {
Warnf("JSON encode failed: %v\n", err)
}
} }
printNode = func(path string, node *restic.Node) { printNode = func(path string, node *restic.Node) {
@ -182,7 +184,9 @@ func runLs(opts LsOptions, gopts GlobalOptions, args []string) error {
ChangeTime: node.ChangeTime, ChangeTime: node.ChangeTime,
StructType: "node", StructType: "node",
}) })
panic(err) if err != nil {
Warnf("JSON encode failed: %v\n", err)
}
} }
} else { } else {
printSnapshot = func(sn *restic.Snapshot) { printSnapshot = func(sn *restic.Snapshot) {