diff --git a/packages/mermaid/src/diagrams/mindmap/mindmapDb.ts b/packages/mermaid/src/diagrams/mindmap/mindmapDb.ts index 065f2c936..92426a7bb 100644 --- a/packages/mermaid/src/diagrams/mindmap/mindmapDb.ts +++ b/packages/mermaid/src/diagrams/mindmap/mindmapDb.ts @@ -43,7 +43,6 @@ export class MindmapDB { this.nodeType = nodeType; this.clear(); this.getType = this.getType.bind(this); - this.getMindmap = this.getMindmap.bind(this); this.getElementById = this.getElementById.bind(this); this.getParent = this.getParent.bind(this); this.getMindmap = this.getMindmap.bind(this); diff --git a/packages/mermaid/src/rendering-util/layout-algorithms/cose-bilkent/layout.ts b/packages/mermaid/src/rendering-util/layout-algorithms/cose-bilkent/layout.ts index 79e3b8620..8d739c3a8 100644 --- a/packages/mermaid/src/rendering-util/layout-algorithms/cose-bilkent/layout.ts +++ b/packages/mermaid/src/rendering-util/layout-algorithms/cose-bilkent/layout.ts @@ -65,8 +65,8 @@ export function validateLayoutData(data: LayoutData): boolean { throw new Error('Root node is required'); } - if (!Array.isArray(data.nodes)) { - throw new Error('Nodes array is required in layout data'); + if (!data.nodes || !Array.isArray(data.nodes) || data.nodes.length === 0) { + throw new Error('No nodes found in layout data'); } if (!Array.isArray(data.edges)) {