From 165a922a1334e02c476901d9144bc0157dd4b396 Mon Sep 17 00:00:00 2001 From: Sebastian Jahr Date: Tue, 6 Aug 2024 10:34:01 +0200 Subject: [PATCH] Only set if it is not nullptr --- moveit_core/planning_scene/src/planning_scene.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/moveit_core/planning_scene/src/planning_scene.cpp b/moveit_core/planning_scene/src/planning_scene.cpp index da61a908e8..27e3866e10 100644 --- a/moveit_core/planning_scene/src/planning_scene.cpp +++ b/moveit_core/planning_scene/src/planning_scene.cpp @@ -212,7 +212,10 @@ PlanningScene::PlanningScene(const PlanningSceneConstPtr& parent) : parent_(pare setStateFeasibilityPredicate(parent->getStateFeasibilityPredicate()); setMotionFeasibilityPredicate(parent->getMotionFeasibilityPredicate()); - setCollisionObjectUpdateCallback(parent_->current_world_object_update_callback_); + if (parent_->current_world_object_update_callback_) + { + setCollisionObjectUpdateCallback(parent_->current_world_object_update_callback_); + } // maintain a separate world. Copy on write ensures that most of the object // info is shared until it is modified. @@ -1214,8 +1217,12 @@ void PlanningScene::decoupleParent() (object_types_.value())[it->first] = it->second; } } - current_world_object_update_callback_ = parent_->current_world_object_update_callback_; - setCollisionObjectUpdateCallback(current_world_object_update_callback_); + + if (parent_->current_world_object_update_callback_) + { + current_world_object_update_callback_ = parent_->current_world_object_update_callback_; + setCollisionObjectUpdateCallback(current_world_object_update_callback_); + } parent_.reset(); }