You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Lines 2571 to 2573varlink_info=this.graph ? this.graph.links[input.link] : null;if(this.onConnectionsChange)this.onConnectionsChange(LiteGraph.INPUT,i,true,link_info,input);//link_info has been created now, so its updated// Lines 2588 to 2590varlink_info=this.graph ? this.graph.links[output.links[j]] : null;if(this.onConnectionsChange)this.onConnectionsChange(LiteGraph.OUTPUT,i,true,link_info,output);//link_info has been created now, so its updated
The first line of code acknowledges that link_info may be null, but onConnectionsChange() is always called and is also unconditionally called with the connected argument as true (the comment also suggests that link_info will never be null).
I did a quick sanity check to make sure that- in practice- link_info can be null by cloning a node with a connected input and confirmed that the link_info of the newly initialized node was null. This also contradicts the comment that asserts link_info had been created.
It seems like onConnectionsChange should either be called only when link_info is not null (or is truthy), or the connected argument should be false if link_info == null.
The text was updated successfully, but these errors were encountered:
Having broken data is a situation in the-middle. Should we inform or not when we find a link with broken data?
The comment seems to have copied from another section or that was relevant to a global link_info debugging as noting on other portions.
The null link_info is enough at now to check in the custom implementation to ensure connection is actually valid.
Being a configure event it could be useful sometimes to check and condition on that, but this should not happen: that is a broken link reference. The true on the third parameter specify if connecting or disconnecting, so the meaning would be: trying to connect a broken link while configuring.
So, when registering a callback to onConnectionsChange let's always check that link_info received is good.
In
litegraph.js
:The first line of code acknowledges that
link_info
may benull
, butonConnectionsChange()
is always called and is also unconditionally called with theconnected
argument astrue
(the comment also suggests thatlink_info
will never benull
).I did a quick sanity check to make sure that- in practice-
link_info
can be null by cloning a node with a connected input and confirmed that thelink_info
of the newly initialized node wasnull
. This also contradicts the comment that assertslink_info
had been created.It seems like
onConnectionsChange
should either be called only whenlink_info
is notnull
(or is truthy), or theconnected
argument should befalse
iflink_info == null
.The text was updated successfully, but these errors were encountered: