mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 06:19:24 +02:00
Merge pull request #3544 from AndrewL-64/3304_unlabeled_exception
Fixed labelText undefined behavior
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user