From 2db83a684caa66d6d095b5caac91572b04c489b1 Mon Sep 17 00:00:00 2001 From: Alexander Kita Date: Wed, 16 Oct 2024 07:58:11 -0500 Subject: [PATCH] Fix null pointer bug --- ibm/service/power/resource_ibm_pi_capture.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ibm/service/power/resource_ibm_pi_capture.go b/ibm/service/power/resource_ibm_pi_capture.go index 107a432da9..b91d197490 100644 --- a/ibm/service/power/resource_ibm_pi_capture.go +++ b/ibm/service/power/resource_ibm_pi_capture.go @@ -198,11 +198,13 @@ func resourceIBMPICaptureCreate(ctx context.Context, d *schema.ResourceData, met if err != nil { log.Printf("Error on get of ibm pi capture (%s) while applying pi_user_tags: %s", capturename, err) } - if imagedata.Crn != "" { - oldList, newList := d.GetChange(Arg_UserTags) - err = flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, string(imagedata.Crn), "", UserTagType) - if err != nil { - log.Printf("Error on update of pi capture (%s) pi_user_tags during creation: %s", *imagedata.ImageID, err) + if imagedata != nil { + if imagedata.Crn != "" { + oldList, newList := d.GetChange(Arg_UserTags) + err = flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, string(imagedata.Crn), "", UserTagType) + if err != nil { + log.Printf("Error on update of pi capture (%s) pi_user_tags during creation: %s", *imagedata.ImageID, err) + } } } }