Skip to content

Commit

Permalink
handle nil pointer conversion in service incident urgency config
Browse files Browse the repository at this point in the history
  • Loading branch information
imjaroiswebdev committed Apr 10, 2024
1 parent f5e1159 commit d0af611
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pagerduty/resource_pagerduty_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,15 @@ func flattenIncidentUrgencyRule(v *pagerduty.IncidentUrgencyRule) []interface{}
}

func expandIncidentUrgencyType(v interface{}) *pagerduty.IncidentUrgencyType {
riut := v.([]interface{})[0].(map[string]interface{})
incidentUrgencyType := &pagerduty.IncidentUrgencyType{}
riut := make(map[string]interface{})

data, ok := v.([]interface{})
if ok && len(data) > 0 && !isNilFunc(data[0]) {
riut = data[0].(map[string]interface{})
} else {
return incidentUrgencyType
}

if v, ok := riut["type"]; ok {
incidentUrgencyType.Type = v.(string)
Expand Down

0 comments on commit d0af611

Please sign in to comment.