From: miettinen Date: Thu, 28 Feb 2013 11:40:45 +0000 (+0000) Subject: Nullchecks to save() (refs #4133). X-Git-Tag: simantics-1.10.1~15 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=594cd25a5b943f84df5de48b79805c268eb24eba;p=simantics%2Fsysdyn.git Nullchecks to save() (refs #4133). git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26941 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/functions/FunctionCodeWidget.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/functions/FunctionCodeWidget.java index 078490c3..b41e42d2 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/functions/FunctionCodeWidget.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/functions/FunctionCodeWidget.java @@ -269,21 +269,23 @@ public class FunctionCodeWidget implements Widget { ArrayList inputResources = new ArrayList(); // Create inputs - for (Parameter input : inputs) { - Resource r = GraphUtils.create2(graph, sr.SysdynModelicaFunction_Input, - l0.HasName, input.name, - sr.Variable_type, input.type, - sr.SysdynModelicaFunction_optional, input.optional ? l0.True : l0.False); - if (input.description != null) { - // Description is optional - graph.claimLiteral(r, sr.SysdynModelicaFunction_definition, input.description); + if (inputs != null) { + for (Parameter input : inputs) { + Resource r = GraphUtils.create2(graph, sr.SysdynModelicaFunction_Input, + l0.HasName, input.name, + sr.Variable_type, input.type, + sr.SysdynModelicaFunction_optional, input.optional ? l0.True : l0.False); + if (input.description != null) { + // Description is optional + graph.claimLiteral(r, sr.SysdynModelicaFunction_definition, input.description); + } + inputResources.add(r); } - inputResources.add(r); + graph.claim( + function, + sr.SysdynModelicaFunction_inputs, + ListUtils.create(graph, inputResources)); } - graph.claim( - function, - sr.SysdynModelicaFunction_inputs, - ListUtils.create(graph, inputResources)); } private void removeOutputList(WriteGraph graph) throws DatabaseException { @@ -307,20 +309,22 @@ public class FunctionCodeWidget implements Widget { ArrayList outputResources = new ArrayList(); // Create outputs - for (Parameter output : outputs) { - Resource r = GraphUtils.create2(graph, sr.SysdynModelicaFunction_Output, - l0.HasName, output.name, - sr.Variable_type, output.type); - if (output.description != null) { - // Description is optional - graph.claimLiteral(r, sr.SysdynModelicaFunction_definition, output.description); + if (outputs != null) { + for (Parameter output : outputs) { + Resource r = GraphUtils.create2(graph, sr.SysdynModelicaFunction_Output, + l0.HasName, output.name, + sr.Variable_type, output.type); + if (output.description != null) { + // Description is optional + graph.claimLiteral(r, sr.SysdynModelicaFunction_definition, output.description); + } + outputResources.add(r); } - outputResources.add(r); + graph.claim( + function, + sr.SysdynModelicaFunction_outputs, + ListUtils.create(graph, outputResources)); } - graph.claim( - function, - sr.SysdynModelicaFunction_outputs, - ListUtils.create(graph, outputResources)); }