From 730316a88ef9227e30c6c26ce2b79753efba393e Mon Sep 17 00:00:00 2001
From: Christoph Pohl <christoph.pohl@kit.edu>
Date: Thu, 21 Dec 2023 12:37:01 +0000
Subject: [PATCH] Fix unused return value

---
 source/RobotAPI/components/units/SensorActorUnit.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/source/RobotAPI/components/units/SensorActorUnit.cpp b/source/RobotAPI/components/units/SensorActorUnit.cpp
index f93f684d7..45efd98c5 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();
+    }
 }
-- 
GitLab