Просмотр исходного кода

Scheduler: Fix HLE Threads on guard

Fernando Sahmkow 6 лет назад
Родитель
Сommit
6ed28e15fa
1 измененных файлов с 6 добавлено и 4 удалено
  1. 6 4
      src/core/hle/kernel/scheduler.cpp

+ 6 - 4
src/core/hle/kernel/scheduler.cpp

@@ -689,10 +689,12 @@ void Scheduler::SwitchToCurrent() {
         current_thread = selected_thread;
         current_thread = selected_thread;
         guard.unlock();
         guard.unlock();
         while (!is_context_switch_pending) {
         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<Common::Fiber> next_context;
             std::shared_ptr<Common::Fiber> next_context;
             if (current_thread != nullptr) {
             if (current_thread != nullptr) {