Skip to content

Commit bc5c029

Browse files
committed
Support nullable parameterType
1 parent d44b8cb commit bc5c029

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

FluentValidation.AutoValidation.Mvc/src/Filters/FluentValidationAutoValidationActionFilter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ public async Task OnActionExecutionAsync(ActionExecutingContext actionExecutingC
6161
var hasAutoValidateAlwaysAttribute = parameterInfo?.HasCustomAttribute<AutoValidateAlwaysAttribute>() ?? false;
6262
var hasAutoValidateNeverAttribute = parameterInfo?.HasCustomAttribute<AutoValidateNeverAttribute>() ?? false;
6363

64-
if (subject != null && parameterType.IsCustomType() &&
64+
if (subject != null && parameterType != null && parameterType.IsCustomType() &&
6565
!hasAutoValidateNeverAttribute && (hasAutoValidateAlwaysAttribute || HasValidBindingSource(bindingSource)) &&
66-
serviceProvider.GetValidator(parameterType!) is IValidator validator)
66+
serviceProvider.GetValidator(parameterType) is IValidator validator)
6767
{
6868
// ReSharper disable once SuspiciousTypeConversion.Global
6969
var validatorInterceptor = validator as IValidatorInterceptor;

0 commit comments

Comments
 (0)