diff --git a/rclcpp/include/rclcpp/publisher.hpp b/rclcpp/include/rclcpp/publisher.hpp index 5f713359a0..5ed7b6e320 100644 --- a/rclcpp/include/rclcpp/publisher.hpp +++ b/rclcpp/include/rclcpp/publisher.hpp @@ -237,7 +237,7 @@ class Publisher : public PublisherBase // It's not possible to do that with an unique_ptr, // as do_intra_process_publish takes the ownership of the message. bool inter_process_publish_needed = - get_non_local_subscription_count() > 0; + get_subscription_count() > get_intra_process_subscription_count(); if (inter_process_publish_needed) { auto shared_msg = @@ -306,7 +306,7 @@ class Publisher : public PublisherBase } bool inter_process_publish_needed = - get_non_local_subscription_count() > 0; + get_subscription_count() > get_intra_process_subscription_count(); if (inter_process_publish_needed) { ROSMessageType ros_msg;