From 614e7e4b9f680e01a98116b9a618ebddc5896ce2 Mon Sep 17 00:00:00 2001 From: Luke Usher Date: Mon, 9 Sep 2019 22:12:46 +0100 Subject: [PATCH] Fix crash on CopyRects failure --- src/core/hle/D3D8/Direct3D9/Direct3D9.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp b/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp index e950d594d..8f416deb3 100644 --- a/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp +++ b/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp @@ -4737,6 +4737,14 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_CopyRects) D3DSURFACE_DESC SourceDesc, DestinationDesc; auto pHostSourceSurface = GetHostSurface(pSourceSurface); auto pHostDestSurface = GetHostSurface(pDestinationSurface); + + if (pHostSourceSurface == nullptr || pHostDestSurface == nullptr) { + // Test Case: DOA2 attempts to copy from an index buffer resource type + // TODO: What should we do here? + LOG_TEST_CASE("D3DDevice-CopyRects: Failed to fetch host surfaces"); + return; + } + pHostSourceSurface->GetDesc(&SourceDesc); pHostDestSurface->GetDesc(&DestinationDesc);