Fix the velero repo get nil pointer issue.

Signed-off-by: Xun Jiang <blackpigletbruce@gmail.com>
This commit is contained in:
Xun Jiang
2024-02-08 14:25:29 +08:00
parent 44aa6a7c6b
commit 701e786150

View File

@@ -43,9 +43,8 @@ func NewGetCommand(f client.Factory, use string) *cobra.Command {
crClient, err := f.KubebuilderClient()
cmd.CheckError(err)
var repos *api.BackupRepositoryList
repos := new(api.BackupRepositoryList)
if len(args) > 0 {
repos = new(api.BackupRepositoryList)
for _, name := range args {
repo := new(api.BackupRepository)
err := crClient.Get(context.TODO(), ctrlclient.ObjectKey{Namespace: f.Namespace(), Name: name}, repo)