From ee750edd0a104f379e48dc64dbbf742c9a3b334b Mon Sep 17 00:00:00 2001 From: blueshogun96 Date: Tue, 2 May 2017 14:50:50 -0700 Subject: [PATCH] Error checking for D3DVertexBuffer_Lock --- src/CxbxKrnl/EmuD3D8.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/CxbxKrnl/EmuD3D8.cpp b/src/CxbxKrnl/EmuD3D8.cpp index 6c99283ef..316f0a267 100644 --- a/src/CxbxKrnl/EmuD3D8.cpp +++ b/src/CxbxKrnl/EmuD3D8.cpp @@ -7591,6 +7591,13 @@ VOID WINAPI XTL::EMUPATCH(D3DVertexBuffer_Lock) IDirect3DVertexBuffer8 *pVertexBuffer8 = pVertexBuffer->EmuVertexBuffer8; + // Let's verify this VB exists before trying to lock it... + if( !pVertexBuffer8 ) + { + EmuWarning("EmuVertexBuffer8 == NULL!"); + return; + } + HRESULT hRet = pVertexBuffer8->Lock(OffsetToLock, SizeToLock, ppbData, Flags); if(FAILED(hRet)) EmuWarning("VertexBuffer Lock Failed!");