Skip to content

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.

ProviderExtensions - prevent for exception when List is null

KrzysztofPajakf3cd8582297f
diff --git a/src/Core/Grand.Infrastructure/Extensions/ProviderExtensions.cs b/src/Core/Grand.Infrastructure/Extensions/ProviderExtensions.cs
index 82b026e2b..c16f5e12c 100644
--- a/src/Core/Grand.Infrastructure/Extensions/ProviderExtensions.cs
+++ b/src/Core/Grand.Infrastructure/Extensions/ProviderExtensions.cs
@@ -28,7 +28,7 @@ namespace Grand.Infrastructure.Extensions
if (string.IsNullOrEmpty(storeId))
return true;
- if (!method.LimitedToStores.Any())
+ if (method.LimitedToStores == null || !method.LimitedToStores.Any())
return true;
if (!method.LimitedToStores.Contains(storeId))
@@ -45,7 +45,7 @@ namespace Grand.Infrastructure.Extensions
if (customer == null)
return true;
- if (!method.LimitedToGroups.Any())
+ if (method.LimitedToGroups == null || !method.LimitedToGroups.Any())
return true;
if (!method.LimitedToGroups.ContainsAny(customer.Groups.Select(x => x)))