From f85c8584b0e6b976ec8ba01fcda2f56b033f56cf Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sun, 22 Nov 2020 12:57:50 +0300 Subject: [PATCH] Attempt to fix #9316 --- rpcs3/Emu/CPU/CPUThread.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index c3393a61ac..0567e367a6 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -329,11 +329,17 @@ namespace cpu_counter void remove(cpu_thread* _this) noexcept { + // Return if not registered + const u32 slot = s_tls_thread_slot; + + if (slot == umax) + { + return; + } + // Unregister and wait if necessary verify(HERE), _this->state & cpu_flag::wait; - u32 slot = s_tls_thread_slot; - if (slot >= std::size(s_cpu_list)) { sys_log.fatal("Index out of bounds (%u)." HERE, slot);