From d4ffa4002bbe6e4470eeff7987bcaa3b34525978 Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Thu, 18 Jan 2018 13:23:38 -0600 Subject: [PATCH] Add NULL pointer check to remove_event. #545 Added the NULL pointer check and return immediately if the pointer is NULL. --- trick_source/sim_services/EventManager/EventManager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/trick_source/sim_services/EventManager/EventManager.cpp b/trick_source/sim_services/EventManager/EventManager.cpp index 53c5c6fe..ebbd5227 100644 --- a/trick_source/sim_services/EventManager/EventManager.cpp +++ b/trick_source/sim_services/EventManager/EventManager.cpp @@ -178,6 +178,10 @@ int Trick::EventManager::remove_event(Trick::Event * in_event) { unsigned int ii , jj ; + if ( ! in_event ) { + return 0 ; + } + if ( in_event->get_before_after() == Trick::EVENT_NOTARGET ) { /* If the event is cyclic, remove the event from the event processor on the event's thread */ event_processors[in_event->get_thread()]->remove_event(in_event) ;