[ModelSurfs] Null check

This commit is contained in:
momo5502 2017-01-25 10:00:17 +01:00
parent a2a7aeaa97
commit 81f6b084eb

View File

@ -194,14 +194,14 @@ namespace Components
auto buffer = ModelSurfs::BufferMap.find(surface->triIndices); auto buffer = ModelSurfs::BufferMap.find(surface->triIndices);
if (buffer != ModelSurfs::BufferMap.end()) if (buffer != ModelSurfs::BufferMap.end())
{ {
buffer->second->Release(); if(buffer->second) buffer->second->Release();
ModelSurfs::BufferMap.erase(buffer); ModelSurfs::BufferMap.erase(buffer);
} }
buffer = ModelSurfs::BufferMap.find(surface->verts0); buffer = ModelSurfs::BufferMap.find(surface->verts0);
if (buffer != ModelSurfs::BufferMap.end()) if (buffer != ModelSurfs::BufferMap.end())
{ {
buffer->second->Release(); if (buffer->second) buffer->second->Release();
ModelSurfs::BufferMap.erase(buffer); ModelSurfs::BufferMap.erase(buffer);
} }
} }