Input processor crashes if second event with same name is created

When allocating a new event, if the same name is used, no allocation is
created and NULL is returned.  We start trying to use the returned value
which seg-faulted.  I added a check to only continue if the returned value
from the allocation is not NULL.

refs #149
This commit is contained in:
Alex Lin 2015-12-02 10:44:27 -06:00
parent 03d89ef56a
commit 014d78e388

View File

@ -30,7 +30,9 @@ Trick::IPPythonEvent * ippython_new_event(std::string event_name) {
// Allocate space for the event.
oss << "Trick::IPPythonEvent " << event_name << "[1]" ;
Trick::IPPythonEvent * event = (Trick::IPPythonEvent*) TMM_declare_var_s(oss.str().c_str());
event->set_name(event_name) ;
if (event != NULL) {
event->set_name(event_name) ;
}
return (event);
}