From 355bb4ff193acfdac0e413e62feba7e233af95e5 Mon Sep 17 00:00:00 2001 From: vinay-gopalan <86625824+vinay-gopalan@users.noreply.github.com> Date: Wed, 17 Apr 2024 14:09:30 -0700 Subject: [PATCH] add nil check when unassigning roles (#191) --- client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.go b/client.go index 3c342aa0..c0222160 100644 --- a/client.go +++ b/client.go @@ -217,7 +217,7 @@ func (c *client) unassignRoles(ctx context.Context, roleIDs []string) error { ctxWithResp := policy.WithCaptureResponse(ctx, &rawResponse) if _, err := c.provider.DeleteRoleAssignmentByID(ctxWithResp, id); err != nil { // If a role was deleted manually then Azure returns a error and status 204 - if rawResponse.StatusCode == http.StatusNoContent || rawResponse.StatusCode == http.StatusNotFound { + if rawResponse != nil && rawResponse.StatusCode == http.StatusNoContent || rawResponse.StatusCode == http.StatusNotFound { continue }