From a3b116b9c49edd0c23b59129a774a969f9f92a65 Mon Sep 17 00:00:00 2001 From: kt Date: Wed, 8 Nov 2023 10:26:17 -0800 Subject: [PATCH] fix pnic with web auto heal settings (actions) --- .../services/appservice/helpers/auto_heal.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/internal/services/appservice/helpers/auto_heal.go b/internal/services/appservice/helpers/auto_heal.go index 0b518fbd831a..e797659e09d1 100644 --- a/internal/services/appservice/helpers/auto_heal.go +++ b/internal/services/appservice/helpers/auto_heal.go @@ -466,17 +466,18 @@ func expandAutoHealSettingsWindows(autoHealSettings []AutoHealSettingWindows) *w result.Triggers.StatusCodesRange = &statusCodeRangeTriggers } - action := autoHeal.Actions[0] - result.Actions.ActionType = web.AutoHealActionType(action.ActionType) - result.Actions.MinProcessExecutionTime = pointer.To(action.MinimumProcessTime) - if len(action.CustomAction) != 0 { - customAction := action.CustomAction[0] - result.Actions.CustomAction = &web.AutoHealCustomAction{ - Exe: pointer.To(customAction.Executable), - Parameters: pointer.To(customAction.Parameters), + if len(autoHeal.Actions) > 0 { + action := autoHeal.Actions[0] + result.Actions.ActionType = web.AutoHealActionType(action.ActionType) + result.Actions.MinProcessExecutionTime = pointer.To(action.MinimumProcessTime) + if len(action.CustomAction) != 0 { + customAction := action.CustomAction[0] + result.Actions.CustomAction = &web.AutoHealCustomAction{ + Exe: pointer.To(customAction.Executable), + Parameters: pointer.To(customAction.Parameters), + } } } - return result }