Fixed: Calling member function on null object is undefined behavior.

--HG--
branch : patches-from-atys
hg/hotfix/patches-from-atys
Nimetu 5 years ago
parent a6a8cb99f5
commit 249ce945f1

@ -595,6 +595,7 @@ COutpostSquadManager::COutpostSquadManager(COutpost* parent, uint32 alias, std::
eventAction = NULL; eventAction = NULL;
// Register event handler // Register event handler
// FIXME: 0 == CAIAliasDescriptionNode instance
event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType); event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType);
event->processEventDescription(&eventDescription, getStateMachine()); event->processEventDescription(&eventDescription, getStateMachine());
getStateMachine()->eventReactions().addChild(event); getStateMachine()->eventReactions().addChild(event);
@ -618,6 +619,7 @@ COutpostSquadManager::COutpostSquadManager(COutpost* parent, uint32 alias, std::
eventAction = NULL; eventAction = NULL;
// Register event handler // Register event handler
// FIXME: 0 == CAIAliasDescriptionNode instance
event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType); event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType);
event->processEventDescription(&eventDescription, getStateMachine()); event->processEventDescription(&eventDescription, getStateMachine());
getStateMachine()->eventReactions().addChild(event); getStateMachine()->eventReactions().addChild(event);
@ -641,6 +643,7 @@ COutpostSquadManager::COutpostSquadManager(COutpost* parent, uint32 alias, std::
eventAction = NULL; eventAction = NULL;
// Register event handler // Register event handler
// FIXME: 0 == CAIAliasDescriptionNode instance
event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType); event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType);
event->processEventDescription(&eventDescription, getStateMachine()); event->processEventDescription(&eventDescription, getStateMachine());
getStateMachine()->eventReactions().addChild(event); getStateMachine()->eventReactions().addChild(event);
@ -675,6 +678,7 @@ COutpostSquadManager::COutpostSquadManager(COutpost* parent, uint32 alias, std::
eventAction = NULL; eventAction = NULL;
// Register event handler // Register event handler
// FIXME: 0 == CAIAliasDescriptionNode instance
event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType); event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType);
event->processEventDescription(&eventDescription, getStateMachine()); event->processEventDescription(&eventDescription, getStateMachine());
getStateMachine()->eventReactions().addChild(event); getStateMachine()->eventReactions().addChild(event);

@ -759,6 +759,7 @@ CSpireSquadManager::CSpireSquadManager(CSpire* parent, uint32 alias, std::string
eventAction = NULL; eventAction = NULL;
// Register event handler // Register event handler
// FIXME: 0 == CAIAliasDescriptionNode instance
event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType); event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType);
event->processEventDescription(&eventDescription, getStateMachine()); event->processEventDescription(&eventDescription, getStateMachine());
getStateMachine()->eventReactions().addChild(event); getStateMachine()->eventReactions().addChild(event);
@ -782,6 +783,7 @@ CSpireSquadManager::CSpireSquadManager(CSpire* parent, uint32 alias, std::string
eventAction = NULL; eventAction = NULL;
// Register event handler // Register event handler
// FIXME: 0 == CAIAliasDescriptionNode instance
event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType); event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType);
event->processEventDescription(&eventDescription, getStateMachine()); event->processEventDescription(&eventDescription, getStateMachine());
getStateMachine()->eventReactions().addChild(event); getStateMachine()->eventReactions().addChild(event);
@ -805,6 +807,7 @@ CSpireSquadManager::CSpireSquadManager(CSpire* parent, uint32 alias, std::string
eventAction = NULL; eventAction = NULL;
// Register event handler // Register event handler
// FIXME: 0 == CAIAliasDescriptionNode instance
event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType); event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType);
event->processEventDescription(&eventDescription, getStateMachine()); event->processEventDescription(&eventDescription, getStateMachine());
getStateMachine()->eventReactions().addChild(event); getStateMachine()->eventReactions().addChild(event);
@ -839,6 +842,7 @@ CSpireSquadManager::CSpireSquadManager(CSpire* parent, uint32 alias, std::string
eventAction = NULL; eventAction = NULL;
// Register event handler // Register event handler
// FIXME: 0 == CAIAliasDescriptionNode instance
event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType); event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType);
event->processEventDescription(&eventDescription, getStateMachine()); event->processEventDescription(&eventDescription, getStateMachine());
getStateMachine()->eventReactions().addChild(event); getStateMachine()->eventReactions().addChild(event);

@ -2688,7 +2688,7 @@ CAILogicActionCode::CAILogicActionCode (const std::vector<std::string> &args, c
const CAIAliasDescriptionNode *eventNode, CStateMachine *container) const CAIAliasDescriptionNode *eventNode, CStateMachine *container)
{ {
nldebug("loadActionCode"); nldebug("loadActionCode");
_byteCode=CCompiler::getInstance().compileCode (args, eventNode->fullName()); _byteCode=CCompiler::getInstance().compileCode (args, eventNode ? eventNode->fullName() : "NULL");
} }
bool CAILogicActionCode::executeAction(CStateInstance *entity,const IAIEvent *event) bool CAILogicActionCode::executeAction(CStateInstance *entity,const IAIEvent *event)

Loading…
Cancel
Save