diff --git a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp index c18eedd176..098a24ff5b 100644 --- a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp +++ b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp @@ -105,7 +105,9 @@ void SensorsHidlEnvironment::HidlTearDown() { if (stopThread) { *stopThread = true; } - pollThread.detach(); + if (pollThread.joinable()) { + pollThread.detach(); + } } void SensorsHidlEnvironment::resetHal() {