Skip to content

Commit 6eaf9a3

Browse files
GLTF Model Builder: check null index allocation
1 parent f2e3aee commit 6eaf9a3

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

AssetLoader/src/GLTFBuilder.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,16 @@ void ModelBuilder::InitIndexBuffer(IRenderDevice* pDevice)
249249
{
250250
m_Model.IndexData.pAllocation = m_CI.pResourceManager->AllocateIndices(DataSize, 4);
251251

252-
auto pBuffInitData = BufferInitData::Create();
253-
pBuffInitData->Data.emplace_back(std::move(m_IndexData));
254-
m_Model.IndexData.pAllocation->SetUserData(pBuffInitData);
252+
if (m_Model.IndexData.pAllocation)
253+
{
254+
auto pBuffInitData = BufferInitData::Create();
255+
pBuffInitData->Data.emplace_back(std::move(m_IndexData));
256+
m_Model.IndexData.pAllocation->SetUserData(pBuffInitData);
257+
}
258+
else
259+
{
260+
UNEXPECTED("Failed to allocate indices from the pool.");
261+
}
255262
}
256263
else
257264
{

0 commit comments

Comments
 (0)