Skip to content

Commit 5596ab5

Browse files
committed
Fix callback group logic in executor
Signed-off-by: Michael Carroll <[email protected]>
1 parent ef73948 commit 5596ab5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

rclcpp/src/rclcpp/executor.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ Executor::get_next_ready_executable(AnyExecutable & any_executable)
689689
auto entity_iter = current_collection_.timers.find(timer->get_timer_handle().get());
690690
if (entity_iter != current_collection_.timers.end()) {
691691
auto callback_group = entity_iter->second.callback_group.lock();
692-
if (callback_group && !callback_group->can_be_taken_from()) {
692+
if (!callback_group || !callback_group->can_be_taken_from()) {
693693
continue;
694694
}
695695
// At this point the timer is either ready for execution or was perhaps
@@ -715,7 +715,7 @@ Executor::get_next_ready_executable(AnyExecutable & any_executable)
715715
subscription->get_subscription_handle().get());
716716
if (entity_iter != current_collection_.subscriptions.end()) {
717717
auto callback_group = entity_iter->second.callback_group.lock();
718-
if (callback_group && !callback_group->can_be_taken_from()) {
718+
if (!callback_group || !callback_group->can_be_taken_from()) {
719719
continue;
720720
}
721721
any_executable.subscription = subscription;
@@ -731,7 +731,7 @@ Executor::get_next_ready_executable(AnyExecutable & any_executable)
731731
auto entity_iter = current_collection_.services.find(service->get_service_handle().get());
732732
if (entity_iter != current_collection_.services.end()) {
733733
auto callback_group = entity_iter->second.callback_group.lock();
734-
if (callback_group && !callback_group->can_be_taken_from()) {
734+
if (!callback_group || !callback_group->can_be_taken_from()) {
735735
continue;
736736
}
737737
any_executable.service = service;
@@ -747,7 +747,7 @@ Executor::get_next_ready_executable(AnyExecutable & any_executable)
747747
auto entity_iter = current_collection_.clients.find(client->get_client_handle().get());
748748
if (entity_iter != current_collection_.clients.end()) {
749749
auto callback_group = entity_iter->second.callback_group.lock();
750-
if (callback_group && !callback_group->can_be_taken_from()) {
750+
if (!callback_group || !callback_group->can_be_taken_from()) {
751751
continue;
752752
}
753753
any_executable.client = client;
@@ -763,7 +763,7 @@ Executor::get_next_ready_executable(AnyExecutable & any_executable)
763763
auto entity_iter = current_collection_.waitables.find(waitable.get());
764764
if (entity_iter != current_collection_.waitables.end()) {
765765
auto callback_group = entity_iter->second.callback_group.lock();
766-
if (callback_group && !callback_group->can_be_taken_from()) {
766+
if (!callback_group || !callback_group->can_be_taken_from()) {
767767
continue;
768768
}
769769
any_executable.waitable = waitable;
@@ -782,7 +782,6 @@ Executor::get_next_ready_executable(AnyExecutable & any_executable)
782782
}
783783
}
784784

785-
786785
return valid_executable;
787786
}
788787

0 commit comments

Comments
 (0)