Merge pull request #3544 from AndrewL-64/3304_unlabeled_exception

Fixed labelText undefined behavior
This commit is contained in:
Knut Sveidqvist
2022-10-04 07:25:14 +02:00
committed by GitHub

View File

@@ -19,7 +19,13 @@ export const labelHelper = (parent, node, _classes, isNode) => {
// Create the label and insert it after the rect
const label = shapeSvg.insert('g').attr('class', 'label').attr('style', node.labelStyle);
const labelText = typeof node.labelText === 'string' ? node.labelText : node.labelText[0];
// Replace labelText with default value if undefined
let labelText;
if (typeof node.labelText === 'undefined') {
labelText = '';
} else {
labelText = typeof node.labelText === 'string' ? node.labelText : node.labelText[0];
}
const text = label
.node()