Skip to content

Commit

Permalink
Check if context is valid when looping in spin_some (#1167)
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
  • Loading branch information
ivanpauno committed Jun 17, 2020
1 parent 70e1830 commit c14f46e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rclcpp/src/rclcpp/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Executor::spin_some(std::chrono::nanoseconds max_duration)
RCLCPP_SCOPE_EXIT(this->spinning.store(false); );
// non-blocking call to pre-load all available work
wait_for_work(std::chrono::milliseconds::zero());
while (spinning.load() && max_duration_not_elapsed()) {
while (rclcpp::ok(context_) && spinning.load() && max_duration_not_elapsed()) {
AnyExecutable any_exec;
if (get_next_ready_executable(any_exec)) {
execute_any_executable(any_exec);
Expand Down

0 comments on commit c14f46e

Please sign in to comment.