From 9755ae2880ee7501041f50dbdce25962fa41cb73 Mon Sep 17 00:00:00 2001 From: baldurk Date: Sun, 31 Jul 2016 13:08:06 +0700 Subject: [PATCH] Don't crash but return NULL if GetNewList() can't allocate --- renderdoc/driver/d3d12/d3d12_device.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_device.cpp b/renderdoc/driver/d3d12/d3d12_device.cpp index 8370edc5c..d25641f34 100644 --- a/renderdoc/driver/d3d12/d3d12_device.cpp +++ b/renderdoc/driver/d3d12/d3d12_device.cpp @@ -1316,7 +1316,7 @@ void WrappedID3D12Device::GPUSync() ID3D12GraphicsCommandList *WrappedID3D12Device::GetNewList() { - ID3D12GraphicsCommandList *ret; + ID3D12GraphicsCommandList *ret = NULL; if(!m_InternalCmds.freecmds.empty()) { @@ -1330,12 +1330,15 @@ ID3D12GraphicsCommandList *WrappedID3D12Device::GetNewList() HRESULT hr = CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, m_Alloc, NULL, __uuidof(ID3D12GraphicsCommandList), (void **)&ret); + RDCASSERTEQUAL(hr, S_OK); + + if(ret == NULL) + return NULL; + if(m_State < WRITING) { GetResourceManager()->AddLiveResource(GetResID(ret), ret); } - - RDCASSERTEQUAL(hr, S_OK); } m_InternalCmds.pendingcmds.push_back(ret);