Fixed analyze warnings in SDL_render_d3d12.c

warning C6011: Dereferencing NULL pointer 'data->swapChain'.
warning C6011: Dereferencing NULL pointer 'data->debugInterface'.
main
Sam Lantinga 2023-12-04 21:38:37 -08:00
parent a28769759b
commit 2b5c7db645
1 changed files with 4 additions and 3 deletions

View File

@ -795,9 +795,10 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
result = E_FAIL;
goto done;
}
D3D12GetDebugInterfaceFunc(D3D_GUID(SDL_IID_ID3D12Debug), (void **)&data->debugInterface);
if (SUCCEEDED(D3D12GetDebugInterfaceFunc(D3D_GUID(SDL_IID_ID3D12Debug), (void **)&data->debugInterface))) {
D3D_CALL(data->debugInterface, EnableDebugLayer);
}
}
#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
#if 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;
}
}