Reply To: NullReferenceException in GraphOwnerInspector.OnDestroy

NodeCanvas Forums Support NullReferenceException in GraphOwnerInspector.OnDestroy Reply To: NullReferenceException in GraphOwnerInspector.OnDestroy

#13823
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.