From ffb771c17f12b062b80155b29d32b0d00abc8dd6 Mon Sep 17 00:00:00 2001 From: Sergi Hernandez Juan <shernand@iri.upc.edu> Date: Wed, 20 Nov 2024 18:18:10 +0100 Subject: [PATCH] Solved a bug when the state is LOST: the result pointer is not valid and generated a segmentation fault. --- include/iri_ros_tools/module_action.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/iri_ros_tools/module_action.h b/include/iri_ros_tools/module_action.h index 182f780..47027a6 100644 --- a/include/iri_ros_tools/module_action.h +++ b/include/iri_ros_tools/module_action.h @@ -223,24 +223,32 @@ class CModuleAction { ROS_ERROR_STREAM("CModuleAction::action_done: goal on server " << this->name << " aborted"); this->status=ACTION_ABORTED; + this->action_result_msg=*result; } if(state==actionlib::SimpleClientGoalState::REJECTED) { ROS_ERROR_STREAM("CModuleAction::action_done: goal on server " << this->name << " rejected"); this->status=ACTION_REJECTED; + this->action_result_msg=*result; } else if(state==actionlib::SimpleClientGoalState::PREEMPTED) { ROS_WARN_STREAM("CModuleAction::action_done: goal on server " << this->name << " preempted"); this->status=ACTION_PREEMPTED; + this->action_result_msg=*result; } else if(state==actionlib::SimpleClientGoalState::SUCCEEDED) { ROS_INFO_STREAM("CModuleAction::action_done: goal on server " << this->name << " successfull"); this->status=ACTION_SUCCESS; + this->action_result_msg=*result; + } + else if(state==actionlib::SimpleClientGoalState::LOST) + { + ROS_INFO_STREAM("CModuleAction::action_done: goal on server " << this->name << " lost"); + this->status=ACTION_SUCCESS; } } - this->action_result_msg=*result; this->action_feedback_msg=Feedback(); this->action_timeout.stop(); this->action_access.exit(); -- GitLab