From 7f0549c9158c6a28e60c9dc6d4348004217d88bc Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Wed, 1 May 2024 09:49:58 -0700 Subject: [PATCH] Prevent AliasPart index from throwing a null exception --- .../OrchardCore.Alias/Indexes/AliasPartIndex.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Alias/Indexes/AliasPartIndex.cs b/src/OrchardCore.Modules/OrchardCore.Alias/Indexes/AliasPartIndex.cs index d93a5d1553c..632d326e7b2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Alias/Indexes/AliasPartIndex.cs +++ b/src/OrchardCore.Modules/OrchardCore.Alias/Indexes/AliasPartIndex.cs @@ -44,7 +44,7 @@ public override async Task UpdatedAsync(UpdateContentContext context) // Search for this part. var contentTypeDefinition = await _contentDefinitionManager.GetTypeDefinitionAsync(context.ContentItem.ContentType); - if (!contentTypeDefinition.Parts.Any(ctd => ctd.Name == nameof(AliasPart))) + if (contentTypeDefinition?.Parts is not null && !contentTypeDefinition.Parts.Any(ctd => string.Equals(ctd.Name, nameof(AliasPart), StringComparison.Ordinal))) { context.ContentItem.Remove(); _partRemoved.Add(context.ContentItem.ContentItemId);