diff --git a/src/editor/js/structures/graph/graph.ts b/src/editor/js/structures/graph/graph.ts index 566589a8a16eded8142f3ad037f89ecc2983388d..0a562e0190c1cc871f2143347eef4f5db537c030 100644 --- a/src/editor/js/structures/graph/graph.ts +++ b/src/editor/js/structures/graph/graph.ts @@ -171,6 +171,21 @@ export class Graph extends ManagedData { node.id = this.nextNodeId; this.nextNodeId += 1; + // Is valid node? + if (node.label == undefined) { + node.label = "Unnamed"; + } + if (node.type == undefined) { + if (this.types.length > 0) { + // Just give first type in list + node.type = this.types[0]; + } else { + // Give empty type + // TODO: Properly add new type, with proper ID. Implemented this.addType(..); + node.type = new NodeType(this); + } + } + this.data.nodes.push(node); this.triggerOnChange();