AssetID check for 0

This commit is contained in:
Xiao Qi 2023-01-07 21:32:16 +08:00
parent ae024e9757
commit c3d027f5b1
1 changed files with 5 additions and 0 deletions

View File

@ -6,6 +6,11 @@ namespace SHADE
template<typename T> template<typename T>
std::enable_if_t<std::is_base_of_v<SHAssetData, T>, T* const> SHAssetManager::GetData(AssetID id) noexcept std::enable_if_t<std::is_base_of_v<SHAssetData, T>, T* const> SHAssetManager::GetData(AssetID id) noexcept
{ {
if (id == 0)
{
return nullptr;
}
if (!assetData.contains(id)) if (!assetData.contains(id))
{ {
for (auto const& asset : std::ranges::views::values(assetCollection)) for (auto const& asset : std::ranges::views::values(assetCollection))