Skip to content

Commit

Permalink
Prevent AliasPart index from throwing a null exception (#15934)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek committed May 2, 2024
1 parent 3c4a5ec commit 3630bd8
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<AliasPart>();
_partRemoved.Add(context.ContentItem.ContentItemId);
Expand Down

0 comments on commit 3630bd8

Please sign in to comment.