From 249ce945f1760039e0707460eeb7e65f11fdaed5 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Tue, 5 Nov 2019 18:50:54 +0200 Subject: [PATCH] Fixed: Calling member function on null object is undefined behavior. --HG-- branch : patches-from-atys --- code/ryzom/server/src/ai_service/ai_outpost.cpp | 4 ++++ code/ryzom/server/src/ai_service/ai_spire.cpp | 4 ++++ code/ryzom/server/src/ai_service/generic_logic_action.cpp | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/code/ryzom/server/src/ai_service/ai_outpost.cpp b/code/ryzom/server/src/ai_service/ai_outpost.cpp index bdbfd537b..385b7a849 100644 --- a/code/ryzom/server/src/ai_service/ai_outpost.cpp +++ b/code/ryzom/server/src/ai_service/ai_outpost.cpp @@ -595,6 +595,7 @@ COutpostSquadManager::COutpostSquadManager(COutpost* parent, uint32 alias, std:: eventAction = NULL; // Register event handler + // FIXME: 0 == CAIAliasDescriptionNode instance event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType); event->processEventDescription(&eventDescription, getStateMachine()); getStateMachine()->eventReactions().addChild(event); @@ -618,6 +619,7 @@ COutpostSquadManager::COutpostSquadManager(COutpost* parent, uint32 alias, std:: eventAction = NULL; // Register event handler + // FIXME: 0 == CAIAliasDescriptionNode instance event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType); event->processEventDescription(&eventDescription, getStateMachine()); getStateMachine()->eventReactions().addChild(event); @@ -641,6 +643,7 @@ COutpostSquadManager::COutpostSquadManager(COutpost* parent, uint32 alias, std:: eventAction = NULL; // Register event handler + // FIXME: 0 == CAIAliasDescriptionNode instance event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType); event->processEventDescription(&eventDescription, getStateMachine()); getStateMachine()->eventReactions().addChild(event); @@ -675,6 +678,7 @@ COutpostSquadManager::COutpostSquadManager(COutpost* parent, uint32 alias, std:: eventAction = NULL; // Register event handler + // FIXME: 0 == CAIAliasDescriptionNode instance event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType); event->processEventDescription(&eventDescription, getStateMachine()); getStateMachine()->eventReactions().addChild(event); diff --git a/code/ryzom/server/src/ai_service/ai_spire.cpp b/code/ryzom/server/src/ai_service/ai_spire.cpp index 5e2c2c05d..f53f1c1aa 100644 --- a/code/ryzom/server/src/ai_service/ai_spire.cpp +++ b/code/ryzom/server/src/ai_service/ai_spire.cpp @@ -759,6 +759,7 @@ CSpireSquadManager::CSpireSquadManager(CSpire* parent, uint32 alias, std::string eventAction = NULL; // Register event handler + // FIXME: 0 == CAIAliasDescriptionNode instance event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType); event->processEventDescription(&eventDescription, getStateMachine()); getStateMachine()->eventReactions().addChild(event); @@ -782,6 +783,7 @@ CSpireSquadManager::CSpireSquadManager(CSpire* parent, uint32 alias, std::string eventAction = NULL; // Register event handler + // FIXME: 0 == CAIAliasDescriptionNode instance event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType); event->processEventDescription(&eventDescription, getStateMachine()); getStateMachine()->eventReactions().addChild(event); @@ -805,6 +807,7 @@ CSpireSquadManager::CSpireSquadManager(CSpire* parent, uint32 alias, std::string eventAction = NULL; // Register event handler + // FIXME: 0 == CAIAliasDescriptionNode instance event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType); event->processEventDescription(&eventDescription, getStateMachine()); getStateMachine()->eventReactions().addChild(event); @@ -839,6 +842,7 @@ CSpireSquadManager::CSpireSquadManager(CSpire* parent, uint32 alias, std::string eventAction = NULL; // Register event handler + // FIXME: 0 == CAIAliasDescriptionNode instance event = new CAIEventReaction(getStateMachine(), 0, eventDescription.EventType); event->processEventDescription(&eventDescription, getStateMachine()); getStateMachine()->eventReactions().addChild(event); diff --git a/code/ryzom/server/src/ai_service/generic_logic_action.cpp b/code/ryzom/server/src/ai_service/generic_logic_action.cpp index a7c01d5ef..7869ffa56 100644 --- a/code/ryzom/server/src/ai_service/generic_logic_action.cpp +++ b/code/ryzom/server/src/ai_service/generic_logic_action.cpp @@ -2688,7 +2688,7 @@ CAILogicActionCode::CAILogicActionCode (const std::vector &args, c const CAIAliasDescriptionNode *eventNode, CStateMachine *container) { 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)