Skip to content

Commit

Permalink
Merge pull request #5708 from dymurray/panic110
Browse files Browse the repository at this point in the history
Prevent nil panic on exec restore hooks (#5675)
  • Loading branch information
Lyndon-Li authored Jan 3, 2023
2 parents b73914d + 8bee9c9 commit 57ffffc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/5708-dymurray
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Prevent nil panic on exec restore hooks
10 changes: 6 additions & 4 deletions pkg/controller/restore_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,12 @@ func (c *restoreController) validateAndComplete(restore *api.Restore, pluginMana
}
for _, resource := range restoreHooks {
for _, h := range resource.RestoreHooks {
for _, container := range h.Init.InitContainers {
err = hook.ValidateContainer(container.Raw)
if err != nil {
restore.Status.ValidationErrors = append(restore.Status.ValidationErrors, err.Error())
if h.Init != nil {
for _, container := range h.Init.InitContainers {
err = hook.ValidateContainer(container.Raw)
if err != nil {
restore.Status.ValidationErrors = append(restore.Status.ValidationErrors, err.Error())
}
}
}
}
Expand Down

0 comments on commit 57ffffc

Please sign in to comment.