Skip to content

Commit

Permalink
Merge pull request ros2#44 from mauropasse/mauro/check-push-event-val…
Browse files Browse the repository at this point in the history
…id-ptr

Check validity of executor pointer
  • Loading branch information
iRobot ROS authored Feb 15, 2021
2 parents bb65717 + 1bc6294 commit b39ab21
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rclcpp/include/rclcpp/executors/events_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ class EventsExecutor : public rclcpp::Executor
static void
push_event(const void * executor_ptr, rmw_listener_event_t event)
{
// Check if the executor pointer is not valid
if (!executor_ptr) {
throw std::runtime_error("The executor pointer is not valid.");
}

// Cast executor_ptr to this (need to remove constness)
auto this_executor = const_cast<executors::EventsExecutor *>(
static_cast<const executors::EventsExecutor *>(executor_ptr));
Expand Down

0 comments on commit b39ab21

Please sign in to comment.