Skip to content

Commit

Permalink
pr-fix: add missing arg null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnmoreels committed Dec 27, 2024
1 parent 5690d49 commit 5f250c3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ public static MessageHandlerCollection WithMessageHandler<TMessageHandler, TMess
where TMessage : class
where TMessageContext : MessageContext
{
if (messageBodySerializer is null)
{
throw new ArgumentNullException(nameof(messageBodySerializer));
}

return WithMessageHandler(services, messageContextFilter, _ => messageBodySerializer, messageBodyFilter, implementationFactory);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ public static MessageHandlerCollection WithMessageHandler<TMessageHandler, TMess
where TMessage : class
where TMessageContext : MessageContext
{
if (messageBodySerializer is null)
{
throw new ArgumentNullException(nameof(messageBodySerializer));
}

return WithMessageHandler<TMessageHandler, TMessage, TMessageContext>(
services, messageContextFilter: messageContextFilter, messageBodySerializerImplementationFactory: _ => messageBodySerializer, messageHandlerImplementationFactory);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ public static MessageHandlerCollection WithMessageHandler<TMessageHandler, TMess
where TMessage : class
where TMessageContext : MessageContext
{
if (messageBodySerializer is null)
{
throw new ArgumentNullException(nameof(messageBodySerializer));
}

return WithMessageHandler<TMessageHandler, TMessage, TMessageContext>(
services,
messageBodySerializerImplementationFactory: _ => messageBodySerializer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ public static MessageHandlerCollection WithMessageHandler<TMessageHandler, TMess
where TMessage : class
where TMessageContext : MessageContext
{
if (messageBodySerializer is null)
{
throw new ArgumentNullException(nameof(messageBodySerializer));
}

return WithMessageHandler<TMessageHandler, TMessage, TMessageContext>(
services,
messageBodySerializerImplementationFactory: _ => messageBodySerializer,
Expand Down

0 comments on commit 5f250c3

Please sign in to comment.