fix: snapshot commands panic if snapshot don't exists (#16138)

This commit is contained in:
yihuang
2023-05-13 08:06:05 +00:00
committed by GitHub
parent 14af232606
commit 92247cb0e9
3 changed files with 10 additions and 0 deletions
+5
View File
@@ -3,6 +3,7 @@ package snapshot
import (
"archive/tar"
"compress/gzip"
"errors"
"fmt"
"io"
"os"
@@ -48,6 +49,10 @@ func DumpArchiveCmd() *cobra.Command {
return err
}
if snapshot == nil {
return errors.New("snapshot don't exists")
}
bz, err := snapshot.Marshal()
if err != nil {
return err