ui: join only if joinable.
The threads in RecoveryUI only get initialized if their Init()s finish
successfully.
Test: recovery_unit_test on marlin.
Change-Id: Ic4b62300a3cbd47887d9f4a90dc26f8a7deab616
diff --git a/ui.cpp b/ui.cpp
index 51d7f12..6c91d01 100644
--- a/ui.cpp
+++ b/ui.cpp
@@ -78,7 +78,9 @@
RecoveryUI::~RecoveryUI() {
ev_exit();
input_thread_stopped_ = true;
- input_thread_.join();
+ if (input_thread_.joinable()) {
+ input_thread_.join();
+ }
}
void RecoveryUI::OnKeyDetected(int key_code) {