Skip to content

Commit b39ab21

Browse files
author
iRobot ROS
authored
Merge pull request #44 from mauropasse/mauro/check-push-event-valid-ptr
Check validity of executor pointer
2 parents bb65717 + 1bc6294 commit b39ab21

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

rclcpp/include/rclcpp/executors/events_executor.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ class EventsExecutor : public rclcpp::Executor
187187
static void
188188
push_event(const void * executor_ptr, rmw_listener_event_t event)
189189
{
190+
// Check if the executor pointer is not valid
191+
if (!executor_ptr) {
192+
throw std::runtime_error("The executor pointer is not valid.");
193+
}
194+
190195
// Cast executor_ptr to this (need to remove constness)
191196
auto this_executor = const_cast<executors::EventsExecutor *>(
192197
static_cast<const executors::EventsExecutor *>(executor_ptr));

0 commit comments

Comments
 (0)