From 4b9ccd03f20e0affb1c6ec01f8d8e7f34f9fac8a Mon Sep 17 00:00:00 2001 From: Stephen Brawner Date: Wed, 16 Sep 2020 18:08:38 -0700 Subject: [PATCH] Only exchange intra_process waitable if nonnull 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)); } }