From 53b564c1a6783f2aec6fcc00dc36ce7e2427c56e Mon Sep 17 00:00:00 2001 From: gibbed Date: Sun, 4 Aug 2019 00:49:32 -0500 Subject: [PATCH] [APU] Only set the work event/wait on the worker thread when they actually exist. --- src/xenia/apu/xma_decoder.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/xenia/apu/xma_decoder.cc b/src/xenia/apu/xma_decoder.cc index 8cb562acf..05777051a 100644 --- a/src/xenia/apu/xma_decoder.cc +++ b/src/xenia/apu/xma_decoder.cc @@ -175,15 +175,20 @@ void XmaDecoder::WorkerThreadMain() { void XmaDecoder::Shutdown() { worker_running_ = false; - work_event_->Set(); + + if (work_event_) { + work_event_->Set(); + } if (paused_) { Resume(); } - // Wait for work thread. - xe::threading::Wait(worker_thread_->thread(), false); - worker_thread_.reset(); + if (worker_thread_) { + // Wait for work thread. + xe::threading::Wait(worker_thread_->thread(), false); + worker_thread_.reset(); + } if (context_data_first_ptr_) { memory()->SystemHeapFree(context_data_first_ptr_);