Fix null reference when getting filters of an empty library

This commit is contained in:
crobibero 2020-12-02 07:42:25 -07:00
parent 3b4f86579b
commit 41e127d1d2

View File

@ -92,7 +92,12 @@ namespace Jellyfin.Api.Controllers
} }
}; };
var itemList = ((Folder)item!).GetItemList(query); var itemList = ((Folder?)item)?.GetItemList(query);
if (itemList == null)
{
return new QueryFiltersLegacy();
}
return new QueryFiltersLegacy return new QueryFiltersLegacy
{ {
Years = itemList.Select(i => i.ProductionYear ?? -1) Years = itemList.Select(i => i.ProductionYear ?? -1)