Use ? and ?? where applicable

This commit is contained in:
Patrick Barron
2020-04-05 12:45:01 -04:00
parent 6a3f9253db
commit 961f48f5bc
13 changed files with 42 additions and 102 deletions

View File

@@ -279,7 +279,7 @@ namespace MediaBrowser.Api
if (!item.ChannelId.Equals(Guid.Empty))
{
var channel = _libraryManager.GetItemById(item.ChannelId);
result.ChannelName = channel == null ? null : channel.Name;
result.ChannelName = channel?.Name;
}
return result;
@@ -316,12 +316,8 @@ namespace MediaBrowser.Api
private void SetBackdropImageInfo(SearchHint hint, BaseItem item)
{
var itemWithImage = item.HasImage(ImageType.Backdrop) ? item : null;
if (itemWithImage == null)
{
itemWithImage = GetParentWithImage<BaseItem>(item, ImageType.Backdrop);
}
var itemWithImage = (item.HasImage(ImageType.Backdrop) ? item : null)
?? GetParentWithImage<BaseItem>(item, ImageType.Backdrop);
if (itemWithImage != null)
{