From 2b5c7db6458fc1d7289feec296d764c4c5e1e6b1 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 4 Dec 2023 21:38:37 -0800 Subject: [PATCH] Fixed analyze warnings in SDL_render_d3d12.c warning C6011: Dereferencing NULL pointer 'data->swapChain'. warning C6011: Dereferencing NULL pointer 'data->debugInterface'. --- src/render/direct3d12/SDL_render_d3d12.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c index d1cafa5bf..24393fb4d 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -795,8 +795,9 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) result = E_FAIL; goto done; } - D3D12GetDebugInterfaceFunc(D3D_GUID(SDL_IID_ID3D12Debug), (void **)&data->debugInterface); - D3D_CALL(data->debugInterface, EnableDebugLayer); + if (SUCCEEDED(D3D12GetDebugInterfaceFunc(D3D_GUID(SDL_IID_ID3D12Debug), (void **)&data->debugInterface))) { + D3D_CALL(data->debugInterface, EnableDebugLayer); + } } #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ @@ -1302,7 +1303,7 @@ static HRESULT D3D12_CreateWindowSizeDependentResources(SDL_Renderer *renderer) } } else { result = D3D12_CreateSwapChain(renderer, w, h); - if (FAILED(result)) { + if (FAILED(result) || !data->swapChain) { goto done; } }