From 726a53d2f5dd43f962a62ec610132eb03cdb26d3 Mon Sep 17 00:00:00 2001 From: Xu Wu Date: Mon, 30 Oct 2023 15:27:34 +0800 Subject: [PATCH] fix panic of nil dereference (#23695) --- .../container_registry_task_schedule_run_now_resource.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/services/containers/container_registry_task_schedule_run_now_resource.go b/internal/services/containers/container_registry_task_schedule_run_now_resource.go index a77db842a0f7..0ad4ba38b89d 100644 --- a/internal/services/containers/container_registry_task_schedule_run_now_resource.go +++ b/internal/services/containers/container_registry_task_schedule_run_now_resource.go @@ -8,6 +8,7 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2019-06-01-preview/registries" "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2019-06-01-preview/runs" "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2019-06-01-preview/tasks" @@ -104,8 +105,9 @@ func (r ContainerRegistryTaskScheduleResource) Create() sdk.ResourceFunc { runName := "" for _, v := range *run.Model { - if *v.Properties.Task == taskId.TaskName { - runName = *v.Name + if v.Properties != nil && pointer.From(v.Properties.Task) == taskId.TaskName { + runName = pointer.From(v.Name) + break } }