diff --git a/backends/imgui_impl_dx9.cpp b/backends/imgui_impl_dx9.cpp index 4097ecc41692..82c01bf6a90f 100644 --- a/backends/imgui_impl_dx9.cpp +++ b/backends/imgui_impl_dx9.cpp @@ -443,6 +443,9 @@ void ImGui_ImplDX9_UpdateTextures() { in_tex_data->EnsureFormat(ImTextureFormat_RGBA32); + if (current_texture != NULL && textures.find(current_texture) == textures.end()) + current_texture = NULL; // Make sure we do not access textures released by ImGui_ImplDX9_InvalidateDeviceObjects() + LPDIRECT3DTEXTURE9 new_texture = ImGui_ImplDX9_UpdateTexture(current_texture, in_tex_data); if (current_texture != NULL && new_texture != current_texture) textures.find_erase_unsorted(current_texture);