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);