Skip to content

Commit a876c93

Browse files
committed
survive missing node values
1 parent aae73f5 commit a876c93

File tree

1 file changed

+5
-0
lines changed
  • src/main/java/com/marginallyclever/nodegraphcore

1 file changed

+5
-0
lines changed

src/main/java/com/marginallyclever/nodegraphcore/Graph.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,11 @@ public void updateBounds() {
378378

379379
public void fromJSON(JSONObject jo) throws JSONException {
380380
clear();
381+
// older files might be missing these values.
382+
if(!jo.has("name")) jo.put("name",getName());
383+
if(!jo.has("uniqueID")) jo.put("uniqueID",getUniqueID());
384+
if(!jo.has("label")) jo.put("label", getLabel());
385+
// proceed now that missing values are added.
381386
super.fromJSON(jo);
382387
parseAllNodesFromJSON(jo.getJSONArray("nodes"));
383388
parseAllConnectionsFromJSON(jo.getJSONArray("connections"));

0 commit comments

Comments
 (0)