Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null reference node not handled gracefuly #59

Open
MPozek opened this issue Apr 11, 2021 · 1 comment
Open

Null reference node not handled gracefuly #59

MPozek opened this issue Apr 11, 2021 · 1 comment

Comments

@MPozek
Copy link

MPozek commented Apr 11, 2021

Steps to reproduce:

  1. Create a new graph blueprint class
  2. Create a root node for the blueprint, but don't keep it in a file named after the node (so unity can't serialize the reference)
  3. Create an instance of the graph
  4. Open the graph editor

Nodes list will have a serialized null node and will throw a null reference exception once on first open, and again each time it's opened. Other fields in the graph seem to maybe also not be initialized (didn't dive too deep into the error)

Unity version: 2020.3.2f1
Graphify version: 5.1.4
log.txt

@CoffeeVampir3
Copy link
Owner

CoffeeVampir3 commented Apr 11, 2021

This is indeed a bug, I was able to trivially reproduce it with the steps you provided.

There's two dimensions to this problem;

  1. Local graph data did not account for the possibility of a deleted node.
  2. Graphs with deleted nodes will cause runtime errors as the graph is no longer valid.

I have pushed a fix for issue (1) as of 5.1.6 see commit #61 which includes the following fixes for change tracking, which is run when a graph blueprint is opened or refreshed:

  1. Change Tracking now correctly checks for null
  2. If a null is detected, the editor model and runtime model remove the node.
  3. All links referencing a null node are also pruned as expected during this phase.

This will leave the graph in a completely stable state, as if the node type had never existed to begin with. Let me know if you run into further trouble.

Moving on to issue 2, at the moment, I do not see any meaningful way of correcting issue 2 as this essentially requires manually intervention per-graph to solve and cannot be corrected automatically. The next best thing might be to simply display an error message and an asset link for each effected graph which was invalidated by the deletion. This would require a new system which would track recompilations and perform an analysis, I'm not convinced that such a feature is neccesary at this time but I'll leave this thread open for discussion on the topic.

In addition, change tracking had some robustness problems that I've taken a moment to correct here. Now, any and all changes made will reflect when a graph is opened. See #62

Cheers,
Z.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants