From d5fb7180d0922b9f050193e1fd7106170086c96e Mon Sep 17 00:00:00 2001 From: Robbie Date: Sun, 10 Sep 2017 13:05:39 -0500 Subject: [PATCH] HGA calls sys_rsx_context_attribute before calling sys_rsx_memory_allocate. This inevitably causes RPCS3 to crash. Add nullptr check to prevent this. --- rpcs3/Emu/Cell/lv2/sys_rsx.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rpcs3/Emu/Cell/lv2/sys_rsx.cpp b/rpcs3/Emu/Cell/lv2/sys_rsx.cpp index 05ace4818a..4a145f1d93 100644 --- a/rpcs3/Emu/Cell/lv2/sys_rsx.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_rsx.cpp @@ -230,6 +230,12 @@ s32 sys_rsx_context_attribute(s32 context_id, u32 package_id, u64 a3, u64 a4, u6 auto m_sysrsx = fxm::get(); + if (!m_sysrsx) + { + sys_rsx.error("sys_rsx_context_attribute called before sys_rsx_context_allocate: context_id=0x%x, package_id=0x%x, a3=0x%llx, a4=0x%llx, a5=0x%llx, a6=0x%llx)", context_id, package_id, a3, a4, a5, a6); + return CELL_EINVAL; + } + auto &driverInfo = vm::_ref(m_sysrsx->driverInfo); switch (package_id) {