Reply To: NullReferenceException in GraphOwnerInspector.OnDestroy

Forums 💬 NodeCanvas ⚙️ Support NullReferenceException in GraphOwnerInspector.OnDestroy Reply To: NullReferenceException in GraphOwnerInspector.OnDestroy

#17031
sugoidev
Participant

    Maybe I misunderstood your reply, but I think the reported issue is that this

    if (owner == null && owner.graph != null){

    will always throw depending on the order Unity destroys the object.
    It will try to evaluate owner.graph when owner is null.
    The fix is to use

    if (owner != null && owner.graph != null){

    so owner.graph is touched when owner is not null.