Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Fix FluentValidationFilter - null reference exception
support6573080d612e
diff --git a/src/Core/Grand.Infrastructure/Validators/FluentValidationFilter.cs b/src/Core/Grand.Infrastructure/Validators/FluentValidationFilter.csindex 325a7d703..0861fade8 100644--- a/src/Core/Grand.Infrastructure/Validators/FluentValidationFilter.cs+++ b/src/Core/Grand.Infrastructure/Validators/FluentValidationFilter.cs@@ -38,8 +38,8 @@ namespace Grand.Infrastructure.Validatorsawait next();return;}-- foreach (var argument in context.ActionArguments.Where(x => !IsSimpleType(x.Value.GetType())))++ foreach (var argument in context.ActionArguments.Where(x => !IsSimpleType(x.Value?.GetType()))){Type genericType = typeof(IValidator<>).MakeGenericType(argument.Value!.GetType());var validator = (IValidator)_serviceProvider.GetService(genericType);@@ -58,8 +58,11 @@ namespace Grand.Infrastructure.Validatorsawait next();}- private static bool IsSimpleType(Type type)+ private static bool IsSimpleType(Type? type){+ if (type == null)+ return true;+returntype.IsPrimitive ||new Type[] {