diff --git a/src/dxgi.cpp b/src/dxgi.cpp index 6871e1167..ecca128b2 100644 --- a/src/dxgi.cpp +++ b/src/dxgi.cpp @@ -142,9 +142,9 @@ namespace bgfx template 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) { return false;