Check nativeWindow pointer before dereferencing (#3185)
Fix access violation in headless mode during bgfx::shutdown(). This pointer is usually set by the SwapChainPanel which doesn't exist in headless mode. Co-authored-by: Yanna Kang <yaka@microsoft.com>
This commit is contained in:
parent
7c440b339f
commit
d952e5cfb3
@ -142,9 +142,9 @@ namespace bgfx
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
static bool trySetSwapChain(IInspectable* nativeWindow, Dxgi::SwapChainI* swapChain, HRESULT* hr)
|
static bool trySetSwapChain(IInspectable* nativeWindow, Dxgi::SwapChainI* swapChain, HRESULT* hr)
|
||||||
{
|
{
|
||||||
ISwapChainPanelNative* swapChainPanelNative;
|
ISwapChainPanelNative* swapChainPanelNative = NULL;
|
||||||
|
|
||||||
if (FAILED(nativeWindow->QueryInterface(__uuidof(T), (void**)&swapChainPanelNative))
|
if (NULL != nativeWindow && FAILED(nativeWindow->QueryInterface(__uuidof(T), (void**)&swapChainPanelNative))
|
||||||
|| NULL == swapChainPanelNative)
|
|| NULL == swapChainPanelNative)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user