diff --git a/examples/imgui_impl_dx10.cpp b/examples/imgui_impl_dx10.cpp index 476984039..9d5972461 100644 --- a/examples/imgui_impl_dx10.cpp +++ b/examples/imgui_impl_dx10.cpp @@ -23,6 +23,7 @@ #include "imgui_impl_dx10.h" // DirectX +#include #include #include #include @@ -581,6 +582,11 @@ static void ImGui_ImplDX10_SetWindowSize(ImGuiViewport* viewport, ImVec2 size) ID3D10Texture2D* pBackBuffer = NULL; data->SwapChain->ResizeBuffers(0, (UINT)size.x, (UINT)size.y, DXGI_FORMAT_UNKNOWN, 0); data->SwapChain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer)); + if (pBackBuffer == NULL) + { + fprintf(stderr, "ImGui_ImplDX10_SetWindowSize() can't created buffers.\n"); + return; + } g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, &data->RTView); pBackBuffer->Release(); } diff --git a/examples/imgui_impl_dx11.cpp b/examples/imgui_impl_dx11.cpp index f8971bc66..9f5b38249 100644 --- a/examples/imgui_impl_dx11.cpp +++ b/examples/imgui_impl_dx11.cpp @@ -22,6 +22,7 @@ #include "imgui_impl_dx11.h" // DirectX +#include #include #include @@ -588,6 +589,11 @@ static void ImGui_ImplDX11_SetWindowSize(ImGuiViewport* viewport, ImVec2 size) ID3D11Texture2D* pBackBuffer = NULL; data->SwapChain->ResizeBuffers(0, (UINT)size.x, (UINT)size.y, DXGI_FORMAT_UNKNOWN, 0); data->SwapChain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer)); + if (pBackBuffer == NULL) + { + fprintf(stderr, "ImGui_ImplDX11_SetWindowSize() can't created buffers.\n"); + return; + } g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, &data->RTView); pBackBuffer->Release(); }