Better validation in AllocatorPimpl::CreateAliasingResource
diff --git a/src/D3D12MemAlloc.cpp b/src/D3D12MemAlloc.cpp
index cbe5d24..ce678ef 100644
--- a/src/D3D12MemAlloc.cpp
+++ b/src/D3D12MemAlloc.cpp
@@ -3942,7 +3942,8 @@
const UINT64 existingSize = pAllocation->GetSize();
const UINT64 newOffset = existingOffset + AllocationLocalOffset;
- if(AllocationLocalOffset + resAllocInfo.SizeInBytes > existingSize ||
+ if(existingHeap == NULL ||
+ AllocationLocalOffset + resAllocInfo.SizeInBytes > existingSize ||
newOffset % resAllocInfo.Alignment != 0)
{
return E_INVALIDARG;