Skip to content

Commit 1bc6294

Browse files
author
Mauro Passerino
committed
Check validity of executor pointer
1 parent bb65717 commit 1bc6294

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)