From ed095f3bffc97e3a1bfa9947633a4bd471a61f4b Mon Sep 17 00:00:00 2001 From: bamsbamx Date: Wed, 26 Jun 2019 11:51:42 +0200 Subject: [PATCH] kernel: Nullability check for current_cpu when changing memory page table This attempts to fix segfault in some tests where page table is set before initializing cpu core (intended behaviour? might be worth a check...) see: src/tests/core/arm/arm_test_common.cpp see: src/tests/core/arm/dyncom/arm_dyncom_vfp_tests.cpp --- src/core/hle/kernel/kernel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index b048e863fe..2c569355a9 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -53,7 +53,9 @@ void KernelSystem::SetCurrentProcess(std::shared_ptr process) { void KernelSystem::SetCurrentMemPageTable(Memory::PageTable* page_table) { memory.SetCurrentPageTable(page_table); - current_cpu->PageTableChanged(); // notify the CPU the page table in memory has changed + if (current_cpu != nullptr) { + current_cpu->PageTableChanged(); // notify the CPU the page table in memory has changed + } } void KernelSystem::SetCPU(std::shared_ptr cpu) {