From 6ed28e15fa9f4c727cf24990c35b13a35547d943 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Fri, 6 Mar 2020 20:36:05 -0400 Subject: Scheduler: Fix HLE Threads on guard --- src/core/hle/kernel/scheduler.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/core/hle/kernel/scheduler.cpp') diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp index 74d3731fc..d7529360c 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp @@ -689,10 +689,12 @@ void Scheduler::SwitchToCurrent() { current_thread = selected_thread; guard.unlock(); while (!is_context_switch_pending) { - current_thread->context_guard.lock(); - if (current_thread->GetSchedulingStatus() != ThreadSchedStatus::Runnable) { - current_thread->context_guard.unlock(); - break; + if (current_thread != nullptr) { + current_thread->context_guard.lock(); + if (current_thread->GetSchedulingStatus() != ThreadSchedStatus::Runnable) { + current_thread->context_guard.unlock(); + break; + } } std::shared_ptr next_context; if (current_thread != nullptr) { -- cgit v1.2.3