File tree Expand file tree Collapse file tree
rclcpp/src/rclcpp/executors Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -152,7 +152,9 @@ ExecutorNotifyWaitable::add_guard_condition(rclcpp::GuardCondition::WeakPtr weak
152152 auto guard_condition = weak_guard_condition.lock ();
153153 if (guard_condition && notify_guard_conditions_.count (weak_guard_condition) == 0 ) {
154154 notify_guard_conditions_.insert (weak_guard_condition);
155- guard_condition->set_on_trigger_callback (on_ready_callback_);
155+ if (on_ready_callback_) {
156+ guard_condition->set_on_trigger_callback (on_ready_callback_);
157+ }
156158 }
157159}
158160
@@ -163,7 +165,8 @@ ExecutorNotifyWaitable::remove_guard_condition(rclcpp::GuardCondition::WeakPtr w
163165 if (notify_guard_conditions_.count (weak_guard_condition) != 0 ) {
164166 notify_guard_conditions_.erase (weak_guard_condition);
165167 auto guard_condition = weak_guard_condition.lock ();
166- if (guard_condition) {
168+ // If this notify waitable doesn't have an on_ready_callback, then there's nothing to unset
169+ if (guard_condition && on_ready_callback_) {
167170 guard_condition->set_on_trigger_callback (nullptr );
168171 }
169172 }
You can’t perform that action at this time.
0 commit comments