diff --git a/source/RobotAPI/components/units/SensorActorUnit.cpp b/source/RobotAPI/components/units/SensorActorUnit.cpp
index f93f684d72619a4ad402f8f56a5f6c285d00a866..45efd98c586e5bfa15086ddc08a80d65f7c3497a 100644
--- a/source/RobotAPI/components/units/SensorActorUnit.cpp
+++ b/source/RobotAPI/components/units/SensorActorUnit.cpp
@@ -160,6 +160,8 @@ void SensorActorUnit::release(const Ice::Current& c)
 
 void SensorActorUnit::onExitComponent()
 {
-    unitMutex.try_lock(); // try to lock, to ensure that it is locked on unlock call
-    unitMutex.unlock();
+    if (unitMutex.try_lock()) // try to lock, to ensure that it is locked on unlock call
+    {
+        unitMutex.unlock();
+    }
 }