[APU] Only wait on the worker thread if it actually exists.

This commit is contained in:
gibbed 2019-08-04 00:27:49 -05:00
parent e48f4ce004
commit 38a6d110e7
1 changed files with 4 additions and 2 deletions

View File

@ -158,8 +158,10 @@ void AudioSystem::Initialize() {}
void AudioSystem::Shutdown() { void AudioSystem::Shutdown() {
worker_running_ = false; worker_running_ = false;
shutdown_event_->Set(); shutdown_event_->Set();
worker_thread_->Wait(0, 0, 0, nullptr); if (worker_thread_) {
worker_thread_.reset(); worker_thread_->Wait(0, 0, 0, nullptr);
worker_thread_.reset();
}
} }
X_STATUS AudioSystem::RegisterClient(uint32_t callback, uint32_t callback_arg, X_STATUS AudioSystem::RegisterClient(uint32_t callback, uint32_t callback_arg,