Skip to content

Commit

Permalink
Add early return for empty contentTypes array
Browse files Browse the repository at this point in the history
Added a check to ensure that if the `contentTypes` array is empty, the method returns an empty array immediately. This prevents unnecessary processing and potential errors when no content types are provided.
  • Loading branch information
brandonhenricks committed Jan 8, 2025
1 parent 8651622 commit 27f2a94
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/XperienceCommunity.DataRepository/PageTypeRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ public async Task<IEnumerable<IWebPageFieldsSource>> GetByPathAsync<T1, T2>(stri
typeof(T1).GetContentTypeName(), typeof(T2).GetContentTypeName()
];

if (contentTypes.Length == 0)
{
return [];
}

var builder = new ContentItemQueryBuilder()
.ForContentTypes(
config =>
Expand Down

0 comments on commit 27f2a94

Please # to comment.