From 02e5e1b88c22a9cacf928db235134f42787f8cc8 Mon Sep 17 00:00:00 2001
From: Rainer Kartmann <rainer.kartmann@kit.edu>
Date: Fri, 3 Dec 2021 10:09:22 +0100
Subject: [PATCH] Throw exception instead of segfaulting when the current frame
 does not exist

---
 source/RobotAPI/libraries/core/FramedPose.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/source/RobotAPI/libraries/core/FramedPose.cpp b/source/RobotAPI/libraries/core/FramedPose.cpp
index 852477268..c5e4d774b 100644
--- a/source/RobotAPI/libraries/core/FramedPose.cpp
+++ b/source/RobotAPI/libraries/core/FramedPose.cpp
@@ -349,6 +349,10 @@ namespace armarx
 
         Eigen::Matrix4f oldFrameTransformation = Eigen::Matrix4f::Identity();
 
+        if (frame != GlobalFrame and !referenceRobot->hasRobotNode(frame))
+        {
+            throw LocalException() << "The current frame '" << frame << "' does not exists in the robot " << referenceRobot->getName();
+        }
         if (!referenceRobot->hasRobotNode(newFrame))
         {
             throw LocalException() << "The requested frame '" << newFrame << "' does not exists in the robot " << referenceRobot->getName();
-- 
GitLab