Reply To: Probable mistake in GraphOwnerInspector.OnDestroy()

Forums 💬 NodeCanvas ⚙️ Support Probable mistake in GraphOwnerInspector.OnDestroy() Reply To: Probable mistake in GraphOwnerInspector.OnDestroy()

#16896
psykaw
Participant

    You’re both almost right.
    owner == null could return true but owner could be not null (will be destroyed at the end of the frame). == operator is overriden by Unity.

    To prevent null ref exception you should replace condition with this code:
    owner == null && !ReferenceEquals(owner, null) && owner.graph != null