Ensure node/group xrefs are consistent on import

This commit is contained in:
Nick O'Leary 2020-07-10 15:59:28 +01:00
parent 97b7479081
commit 979c5351a8
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 9 additions and 1 deletions

View File

@ -1442,7 +1442,15 @@ RED.nodes = (function() {
return node_map[id];
})
// Just in case the group references a node that doesn't exist for some reason
n.nodes = n.nodes.filter(function(v) { return !!v});
n.nodes = n.nodes.filter(function(v) {
if (v) {
// Repair any nodes that have forgotten they are in this group
if (v.g !== n.id) {
v.g = n.id;
}
}
return !!v
});
if (!n.g) {
groupDepthMap[n.id] = 0;
}