ralian / eai

Enfusion Artifical Intelligence for DayZ and future Bohemia Interactive games.
Apache License 2.0
68 stars 27 forks source link

NULL pointer to instance #14

Closed BorizzK closed 3 years ago

BorizzK commented 3 years ago

https://github.com/ralian/eai/blob/0fd4220ce8536158bd4602b9f8fcb6eb926db732/Scripts/4_World/eAI/Entities/AI/eAIBase.c#L240

BorizzK commented 3 years ago

Function: 'EEHitBy' Stack trace: eAI/Scripts/4_World/eai\entities\ai\eaibase.c:240 SCRIPT (E): NULL pointer to instance Class: 'eAI_SurvivorM_Seth' Entity id:2975470

may be change condition check to

    if (Class.CastTo(zmb, source))
    {
        if (!zmb.GetTargetInformation().IsTargetted(m_eAI_Group)) zmb.GetTargetInformation().AddAI(this);

    } 
ralian commented 3 years ago

@BorizzK That wouldn't fix the issue since it's the same as the lazy evaluation above

the solution would likely be something like

if (Class.CastTo(zmb, source) && zmb.GetTargetInformation() && !zmb.GetTargetInformation().IsTargetted(m_eAI_Group))

but I'm going to let Jacob weigh in since it's his code

ralian commented 3 years ago

Closing as this has been fixed by a reversion on main