Skip to content

Commit

Permalink
GLTF Model Builder: check null index allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Feb 15, 2024
1 parent f2e3aee commit 6eaf9a3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions AssetLoader/src/GLTFBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,16 @@ void ModelBuilder::InitIndexBuffer(IRenderDevice* pDevice)
{
m_Model.IndexData.pAllocation = m_CI.pResourceManager->AllocateIndices(DataSize, 4);

auto pBuffInitData = BufferInitData::Create();
pBuffInitData->Data.emplace_back(std::move(m_IndexData));
m_Model.IndexData.pAllocation->SetUserData(pBuffInitData);
if (m_Model.IndexData.pAllocation)
{
auto pBuffInitData = BufferInitData::Create();
pBuffInitData->Data.emplace_back(std::move(m_IndexData));
m_Model.IndexData.pAllocation->SetUserData(pBuffInitData);
}
else
{
UNEXPECTED("Failed to allocate indices from the pool.");
}
}
else
{
Expand Down

0 comments on commit 6eaf9a3

Please sign in to comment.