BehaviorTreeTask* Workspace::CreateBehaviorTreeTask(const char* relativePath) 函数实现里有 return 0,不知道是否有可能真的会运行这句,如果它返回了0,就会导致
this->m_bt = Workspace::GetInstance()->CreateBehaviorTreeTask(btName.c_str()); // <== 这里返回0 的话
}
CSerializationID nodeId("node");
ISerializableNode* n = btNode->findChild(nodeId);
BEHAVIAC_ASSERT(n);
this->m_bt->Load(n); // <== 这里就会 null pointer dereference
if (pProperty && pProperty->m_bIsStatic) // 这里做了pProperty 的 null 检查, 如果是 null 则跑到下面的步骤
{
int contextId = this->GetContextId();
Context& c = Context::GetContext(contextId);
const char* staticClassName = this->GetObjectTypeName();
const VariableType* pVal = c.GetStaticVariable<VariableType>(staticClassName, variableId);
return *pVal;
}
const VariableType* pVal1 = VariableGettterDispatcher<VariableType, behaviac::Meta::IsRefType<VariableType>::Result>::Get(this->m_variables, this, pProperty, variableId); // 这里没有再做检查就传入了 Get,里面没做检查就进行了 dereference,可能触发 null pointer deference,这个运行路径有可能出现吗
if (pVal1)