prevent exception generating tooltip for deleted nodes

This commit is contained in:
Steve-Mcl 2022-07-06 15:17:58 +01:00
parent 8cb212d897
commit 962672564e
1 changed files with 11 additions and 1 deletions

View File

@ -3293,11 +3293,17 @@ RED.view = (function() {
if (active && ((portType === PORT_TYPE_INPUT && ((d._def && d._def.inputLabels)||d.inputLabels)) || (portType === PORT_TYPE_OUTPUT && ((d._def && d._def.outputLabels)||d.outputLabels)))) {
portLabelHoverTimeout = setTimeout(function() {
const n = port && port.node()
const nId = n && n.__data__ && n.__data__.id
//check see if node has been deleted since timeout started
if(!n || !n.parentNode || !RED.nodes.node(n.__data__.id)) {
return; //node is gone!
}
var tooltip = getPortLabel(d,portType,portIndex);
if (!tooltip) {
return;
}
var pos = getElementPosition(port.node());
var pos = getElementPosition(n);
portLabelHoverTimeout = null;
portLabelHover = showTooltip(
(pos[0]+(portType===PORT_TYPE_INPUT?-2:12)),
@ -3734,6 +3740,10 @@ RED.view = (function() {
if (d.hasOwnProperty('l')?!d.l : (d.type === "link in" || d.type === "link out")) {
var parentNode = this.parentNode;
portLabelHoverTimeout = setTimeout(function() {
//check see if node has been deleted since timeout started
if(!parentNode || !parentNode.parentNode || !RED.nodes.node(parentNode.id)) {
return; //node is gone!
}
var tooltip;
if (d._def.label) {
tooltip = d._def.label;