diff --git a/pitr/cli/internal/cmd/restore.go b/pitr/cli/internal/cmd/restore.go index ad684b7b..67f4d5a4 100644 --- a/pitr/cli/internal/cmd/restore.go +++ b/pitr/cli/internal/cmd/restore.go @@ -151,8 +151,8 @@ func checkDatabaseExist(proxy pkg.IShardingSphereProxy, bak *model.LsBackup) err return xerr.NewCliErr(fmt.Sprintf("get cluster metadata failed. err: %s", err)) } - for k := range bak.SsBackup.ClusterInfo.MetaData.Databases { - if _, ok := clusterNow.MetaData.Databases[k]; ok { + if clusterNow != nil && clusterNow.MetaData.Databases != nil { + for k := range clusterNow.MetaData.Databases { databaseNamesExist = append(databaseNamesExist, k) } }