From e0ff8863a30055b73e0766a485867dbdd8fa38f8 Mon Sep 17 00:00:00 2001 From: Basil Kotov Date: Fri, 2 Aug 2024 08:48:23 +0100 Subject: [PATCH] last segment can be null (#5) --- src/VirtoCommerce.Xapi.Data/Queries/SlugInfoQueryHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/VirtoCommerce.Xapi.Data/Queries/SlugInfoQueryHandler.cs b/src/VirtoCommerce.Xapi.Data/Queries/SlugInfoQueryHandler.cs index 940cc7e..5cb7ab2 100644 --- a/src/VirtoCommerce.Xapi.Data/Queries/SlugInfoQueryHandler.cs +++ b/src/VirtoCommerce.Xapi.Data/Queries/SlugInfoQueryHandler.cs @@ -42,7 +42,7 @@ public async Task Handle(SlugInfoQuery request, CancellationTo var currentCulture = request.CultureName ?? store.DefaultLanguage; var segments = request.Permalink.Split("/", StringSplitOptions.RemoveEmptyEntries); - var lastSegment = segments.Last(); + var lastSegment = segments.LastOrDefault(); var criteria = AbstractTypeFactory.TryCreateInstance(); criteria.StoreId = store.Id;