Fix bad use of hasOwnProperty on an Array

This commit is contained in:
GogoVega 2024-06-11 15:33:00 +02:00
parent a67e89ee67
commit 39d8386e43
No known key found for this signature in database
GPG Key ID: E1E048B63AC5AC2B

View File

@ -2142,7 +2142,7 @@ RED.nodes = (function() {
nodeZmap[recoveryWorkspace.id] = [];
}
node.z = recoveryWorkspace.id;
nodeZmap[recoveryWorkspace.id].push(node);
nodeZmap[node.z].push(node);
}
}
@ -2385,14 +2385,14 @@ RED.nodes = (function() {
});
const newLinks = [];
// Remap all wires and (Config) Node references
// Remap all Wires and (Config) Node references
for (const node of [...newNodes, ...newGroups]) {
if (node.wires) {
for (const wiresGroup of node.wires) {
const wires = Array.isArray(wiresGroup) ? wiresGroup : [wiresGroup];
wires.forEach(function (wire) {
// Skip if the wire is clinked to a non-existent node
// TODO: Add warning message? Add RED.nodes.node() for same workspace?
// TODO: Add warning message?
if (!nodeMap.hasOwnProperty(wire)) { return; }
if (node.z === nodeMap[wire].z) {
const link = { source: node, sourcePort: node.wires.indexOf(wiresGroup), target: nodeMap[wire] };
@ -2521,14 +2521,14 @@ RED.nodes = (function() {
});
for (const index in newGroups) {
if (newGroups.hasOwnProperty(newGroups[index])) {
if (newGroups.indexOf(newGroups[index]) !== -1) {
newGroups[index] = addGroup(newGroups[index]);
nodeMap[newGroups[index].id] = newGroups[index];
}
}
for (const index in newJunctions) {
if (newJunctions.hasOwnProperty(newJunctions[index])) {
if (newJunctions.indexOf(newJunctions[index]) !== -1) {
newJunctions[index] = addJunction(newJunctions[index]);
nodeMap[newJunctions[index].id] = newJunctions[index];
}
@ -2536,7 +2536,7 @@ RED.nodes = (function() {
// Now the nodes have been fully updated, add them as Proxy.
for (const index in newNodes) {
if (newNodes.hasOwnProperty(newNodes[index])) {
if (newNodes.indexOf(newNodes[index]) !== -1) {
newNodes[index] = addNode(newNodes[index]);
nodeMap[newNodes[index].id] = newNodes[index];
}