Checks that contentType isn't null before checking for .ListView (#15791)

For a collection use at the Media root, the `contentType` will be
`null`, and not have a `.ListView` configured, so would need to
fallback to the default collection configuration (data-type).

This was a small regression in PR #15687.
https://github.com/umbraco/Umbraco-CMS/pull/15687/files#diff-2ad7a39ca3a7e9fd7c4cbc72a2a28b28bf0d24c12449beff76ff8eb3b0a3ce99L192
This commit is contained in:
Lee Kelleher
2024-02-28 16:15:42 +00:00
committed by GitHub
parent 5d31a23902
commit ed8df56ff0

View File

@@ -189,7 +189,7 @@ internal abstract class ContentListViewServiceBase<TContent, TContentType, TCont
private async Task<Attempt<ListViewConfiguration?, ContentCollectionOperationStatus>> GetListViewConfigurationFromContentTypeAsync(TContentType? contentType)
{
if (contentType?.ListView is null)
if (contentType is not null && contentType.ListView is null)
{
return Attempt.FailWithStatus<ListViewConfiguration?, ContentCollectionOperationStatus>(ContentCollectionOperationStatus.ContentNotCollection, null);
}