From 94dab807b941d1d723edde18c2783d51fb786317 Mon Sep 17 00:00:00 2001 From: anita-mithran <97292210+anita-mithran@users.noreply.github.com> Date: Mon, 10 Jun 2024 18:16:14 +0530 Subject: [PATCH] Update threshold_profile.go null check added --- site24x7/threshold_profile.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/site24x7/threshold_profile.go b/site24x7/threshold_profile.go index f49c5f0..3ef5ad4 100644 --- a/site24x7/threshold_profile.go +++ b/site24x7/threshold_profile.go @@ -565,8 +565,12 @@ func setCronResourceData(d *schema.ResourceData, thresholdProfile *api.Threshold d.Set("cron_no_run_alert", cronNoRunAlertMap) cronDurationAlertMap := make(map[string]interface{}) - cronDurationAlertMap["trouble"] = int(thresholdProfile.CronDurationAlert["trouble"].(float64)) - d.Set("cron_duration_alert", cronDurationAlertMap) + if thresholdProfile.CronDurationAlert["trouble"] == nil { + d.Set("cron_duration_alert", cronDurationAlertMap) + } else { + cronDurationAlertMap["trouble"] = int(thresholdProfile.CronDurationAlert["trouble"].(float64)) + d.Set("cron_duration_alert", cronDurationAlertMap) + } } func setHeartBeatAttributes(d *schema.ResourceData, thresholdProfile *api.ThresholdProfile) {