From 05f8144748f67481dc9813d5de59832ba1987005 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 4 Dec 2024 12:21:14 -0500 Subject: [PATCH] backend: Fix nil pointer dereference Don't count on OperationID being set in OperationDocuments. Implicit async operations will not have this field set. Get the subscription ID from ExternalID instead. --- backend/operations_scanner.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/operations_scanner.go b/backend/operations_scanner.go index 00e50076b..487b90599 100644 --- a/backend/operations_scanner.go +++ b/backend/operations_scanner.go @@ -165,7 +165,7 @@ func (s *OperationsScanner) pollClusterOperation(ctx context.Context, logger *sl if err != nil { var ocmError *ocmerrors.Error if errors.As(err, &ocmError) && ocmError.Status() == http.StatusNotFound && doc.Request == database.OperationRequestDelete { - err = s.withSubscriptionLock(ctx, logger, doc.OperationID.SubscriptionID, func(ctx context.Context) error { + err = s.withSubscriptionLock(ctx, logger, doc.ExternalID.SubscriptionID, func(ctx context.Context) error { return s.deleteOperationCompleted(ctx, logger, doc) }) if err == nil { @@ -180,7 +180,7 @@ func (s *OperationsScanner) pollClusterOperation(ctx context.Context, logger *sl logger.Warn(err.Error()) err = nil } else { - err = s.withSubscriptionLock(ctx, logger, doc.OperationID.SubscriptionID, func(ctx context.Context) error { + err = s.withSubscriptionLock(ctx, logger, doc.ExternalID.SubscriptionID, func(ctx context.Context) error { return s.updateOperationStatus(ctx, logger, doc, opStatus, opError) }) }