From 30e445a6de12357bc94cab76920b593792ddddcc Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Sat, 23 May 2015 14:25:46 -0500 Subject: [PATCH] VdPersistDisplay - Check if unk1 ptr is NULL --- src/xenia/kernel/xboxkrnl_video.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/xenia/kernel/xboxkrnl_video.cc b/src/xenia/kernel/xboxkrnl_video.cc index d660c16d5..9bcf0a88f 100644 --- a/src/xenia/kernel/xboxkrnl_video.cc +++ b/src/xenia/kernel/xboxkrnl_video.cc @@ -380,11 +380,13 @@ SHIM_CALL VdPersistDisplay_shim(PPCContext* ppc_state, KernelState* state) { // unk1_ptr needs to be populated with a pointer passed to // MmFreePhysicalMemory(1, *unk1_ptr). - auto heap = state->memory()->LookupHeapByType(true, 16 * 1024); - uint32_t unk1_value; - heap->Alloc(64, 32, kMemoryAllocationReserve | kMemoryAllocationCommit, - kMemoryProtectNoAccess, false, &unk1_value); - SHIM_SET_MEM_32(unk1_ptr, unk1_value); + if (unk1_ptr) { + auto heap = state->memory()->LookupHeapByType(true, 16 * 1024); + uint32_t unk1_value; + heap->Alloc(64, 32, kMemoryAllocationReserve | kMemoryAllocationCommit, + kMemoryProtectNoAccess, false, &unk1_value); + SHIM_SET_MEM_32(unk1_ptr, unk1_value); + } // ? SHIM_SET_RETURN_64(1);