From 47e6d76b82f63ac115177b7d7663823be51cffff Mon Sep 17 00:00:00 2001 From: Mohammad Sadegh Shad Date: Wed, 10 Dec 2025 15:54:07 +0330 Subject: [PATCH] Null ref issue when there's no SQS message --- Olive.Aws.EventBus/EventBusQueue.cs | 10 +++++----- Olive.Aws.EventBus/Olive.Aws.EventBus.csproj | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Olive.Aws.EventBus/EventBusQueue.cs b/Olive.Aws.EventBus/EventBusQueue.cs index e64cecc87..9f9c1cef2 100644 --- a/Olive.Aws.EventBus/EventBusQueue.cs +++ b/Olive.Aws.EventBus/EventBusQueue.cs @@ -152,7 +152,7 @@ public async Task PullAll(Func handler) public async Task> PullBatch(int timeoutSeconds = 10, int? maxNumberOfMessages = null) { var result = new List(); - + var request = new ReceiveMessageRequest { QueueUrl = QueueUrl, @@ -160,15 +160,15 @@ public async Task> PullBatch(int timeoutSeconds MaxNumberOfMessages = maxNumberOfMessages ?? MaxNumberOfMessages, VisibilityTimeout = VisibilityTimeout, }; - + var response = await Client.ReceiveMessageAsync(request); - - foreach (var item in response.Messages) + + foreach (var item in response.Messages ?? []) { var receipt = new DeleteMessageRequest { QueueUrl = QueueUrl, ReceiptHandle = item.ReceiptHandle }; result.Add(new QueueMessageHandle(item.Body, item.MessageId, () => Client.DeleteMessageAsync(receipt))); } - + return result; } diff --git a/Olive.Aws.EventBus/Olive.Aws.EventBus.csproj b/Olive.Aws.EventBus/Olive.Aws.EventBus.csproj index 02bd9152c..d6b93bed0 100644 --- a/Olive.Aws.EventBus/Olive.Aws.EventBus.csproj +++ b/Olive.Aws.EventBus/Olive.Aws.EventBus.csproj @@ -1,7 +1,7 @@  netstandard2.0 - 8.0.1 + 8.0.2