Fix flowchart tooltip typing

Tooltip is an object that gets reset to an array. It is then looked up for properties without guard, causing array functions like "length" and "constructor" to run into undefined behvaior.
This commit is contained in:
Lishid
2023-06-29 15:33:35 -04:00
committed by GitHub
parent 8066d94c1d
commit 0cab66c9d8

View File

@@ -342,7 +342,8 @@ export const setLink = function (ids, linkStr, target) {
setClass(ids, 'clickable'); setClass(ids, 'clickable');
}; };
export const getTooltip = function (id) { export const getTooltip = function (id) {
return tooltips[id]; if (tooltips.hasOwnProperty(id)) return tooltips[id];
return undefined;
}; };
/** /**
@@ -443,7 +444,7 @@ export const clear = function (ver = 'gen-1') {
subGraphs = []; subGraphs = [];
subGraphLookup = {}; subGraphLookup = {};
subCount = 0; subCount = 0;
tooltips = []; tooltips = {};
firstGraphFlag = true; firstGraphFlag = true;
version = ver; version = ver;
commonClear(); commonClear();