File tree Expand file tree Collapse file tree 3 files changed +14
-9
lines changed
src/main/java/com/marginallyclever/nodegraphcore Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 44
55 <groupId >com.marginallyclever</groupId >
66 <artifactId >nodegraphcore</artifactId >
7- <version >1.5.10 </version >
7+ <version >1.5.11 </version >
88
99 <name >NodeGraphCore</name >
1010 <description >Flow based programming in Java.</description >
Original file line number Diff line number Diff line change @@ -381,7 +381,6 @@ public void fromJSON(JSONObject jo) throws JSONException {
381381 // older files might be missing these values.
382382 if (!jo .has ("name" )) jo .put ("name" ,getName ());
383383 if (!jo .has ("uniqueID" )) jo .put ("uniqueID" ,getUniqueID ());
384- if (!jo .has ("label" )) jo .put ("label" , getLabel ());
385384 // proceed now that missing values are added.
386385 super .fromJSON (jo );
387386 parseAllNodesFromJSON (jo .getJSONArray ("nodes" ));
Original file line number Diff line number Diff line change @@ -288,8 +288,10 @@ public void moveRelative(int dx, int dy) {
288288 }
289289
290290 public void fromJSON (JSONObject jo ) throws JSONException {
291- String joName = jo .getString ("name" );
292- if (!name .equals (joName )) throw new JSONException ("Node types do not match: " +name +", " +joName );
291+ if (jo .has ("name" )) {
292+ String joName = jo .getString ("name" );
293+ if (!name .equals (joName )) throw new JSONException ("Node types do not match: " + name + ", " + joName );
294+ }
293295
294296 Object uid = jo .get ("uniqueID" );
295297 uniqueID = (uid instanceof String ) ? (String )uid : uid .toString ();
@@ -298,11 +300,15 @@ public void fromJSON(JSONObject jo) throws JSONException {
298300 String s = jo .getString ("label" );
299301 if (!s .equals ("null" )) label = s ;
300302 }
301- // bounds
302- RectangleDAO4JSON dao = new RectangleDAO4JSON ();
303- rectangle .setBounds (dao .fromJSON (jo .getJSONObject ("rectangle" )));
304- // all ports
305- parseAllPortsFromJSON (jo .getJSONArray ("variables" ));
303+ if (jo .has ("rectangle" )) {
304+ // get the rectangle
305+ RectangleDAO4JSON dao = new RectangleDAO4JSON ();
306+ rectangle .setBounds (dao .fromJSON (jo .getJSONObject ("rectangle" )));
307+ }
308+ if (jo .has ("ports" )) {
309+ // all ports
310+ parseAllPortsFromJSON (jo .getJSONArray ("variables" ));
311+ }
306312 }
307313
308314 protected void parseAllPortsFromJSON (JSONArray vars ) throws JSONException {
You can’t perform that action at this time.
0 commit comments