From c357cc224ef45fa3331637dc6022c58a27c3320c Mon Sep 17 00:00:00 2001 From: brawner Date: Thu, 17 Sep 2020 13:57:44 -0700 Subject: [PATCH] Only exchange intra_process waitable if nonnull (#1317) Signed-off-by: Stephen Brawner --- rclcpp/include/rclcpp/wait_set_template.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rclcpp/include/rclcpp/wait_set_template.hpp b/rclcpp/include/rclcpp/wait_set_template.hpp index 87e3974ac6..39c7dd3d4e 100644 --- a/rclcpp/include/rclcpp/wait_set_template.hpp +++ b/rclcpp/include/rclcpp/wait_set_template.hpp @@ -233,9 +233,9 @@ class WaitSetTemplate final : private SynchronizationPolicy, private StoragePoli } if (mask.include_intra_process_waitable) { auto local_waitable = inner_subscription->get_intra_process_waitable(); - inner_subscription->exchange_in_use_by_wait_set_state(local_waitable.get(), false); if (nullptr != local_waitable) { - // This is the case when intra process is disabled for the subscription. + // This is the case when intra process is enabled for the subscription. + inner_subscription->exchange_in_use_by_wait_set_state(local_waitable.get(), false); this->storage_remove_waitable(std::move(local_waitable)); } }