]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Nullchecks to save() (refs #4133).
authormiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 28 Feb 2013 11:40:45 +0000 (11:40 +0000)
committermiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 28 Feb 2013 11:40:45 +0000 (11:40 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26941 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/functions/FunctionCodeWidget.java

index 078490c34c52d43af16aa51ad5cb1a2907e2000c..b41e42d2f9b5e1cb2e5c3ecdc5f1d7e1d3d6ffc7 100644 (file)
@@ -269,21 +269,23 @@ public class FunctionCodeWidget implements Widget {
                 \r
                 ArrayList<Resource> inputResources = new ArrayList<Resource>();\r
                 // Create inputs\r
-                for (Parameter input : inputs) {\r
-                    Resource r = GraphUtils.create2(graph, sr.SysdynModelicaFunction_Input,\r
-                            l0.HasName, input.name, \r
-                            sr.Variable_type, input.type,\r
-                            sr.SysdynModelicaFunction_optional, input.optional ? l0.True : l0.False);\r
-                    if (input.description != null) {\r
-                        // Description is optional\r
-                        graph.claimLiteral(r, sr.SysdynModelicaFunction_definition, input.description);\r
+                if (inputs != null) {\r
+                    for (Parameter input : inputs) {\r
+                        Resource r = GraphUtils.create2(graph, sr.SysdynModelicaFunction_Input,\r
+                                l0.HasName, input.name, \r
+                                sr.Variable_type, input.type,\r
+                                sr.SysdynModelicaFunction_optional, input.optional ? l0.True : l0.False);\r
+                        if (input.description != null) {\r
+                            // Description is optional\r
+                            graph.claimLiteral(r, sr.SysdynModelicaFunction_definition, input.description);\r
+                        }\r
+                        inputResources.add(r);\r
                     }\r
-                    inputResources.add(r);\r
+                    graph.claim(\r
+                            function, \r
+                            sr.SysdynModelicaFunction_inputs, \r
+                            ListUtils.create(graph, inputResources));\r
                 }\r
-                graph.claim(\r
-                        function, \r
-                        sr.SysdynModelicaFunction_inputs, \r
-                        ListUtils.create(graph, inputResources));\r
            }\r
            \r
            private void removeOutputList(WriteGraph graph) throws DatabaseException {\r
@@ -307,20 +309,22 @@ public class FunctionCodeWidget implements Widget {
 \r
                 ArrayList<Resource> outputResources = new ArrayList<Resource>();\r
                 // Create outputs\r
-                for (Parameter output : outputs) {\r
-                    Resource r = GraphUtils.create2(graph, sr.SysdynModelicaFunction_Output,\r
-                            l0.HasName, output.name, \r
-                            sr.Variable_type, output.type);\r
-                    if (output.description != null) {\r
-                        // Description is optional\r
-                        graph.claimLiteral(r, sr.SysdynModelicaFunction_definition, output.description);\r
+                if (outputs != null) {\r
+                    for (Parameter output : outputs) {\r
+                        Resource r = GraphUtils.create2(graph, sr.SysdynModelicaFunction_Output,\r
+                                l0.HasName, output.name, \r
+                                sr.Variable_type, output.type);\r
+                        if (output.description != null) {\r
+                            // Description is optional\r
+                            graph.claimLiteral(r, sr.SysdynModelicaFunction_definition, output.description);\r
+                        }\r
+                        outputResources.add(r);\r
                     }\r
-                    outputResources.add(r);\r
+                    graph.claim(\r
+                            function, \r
+                            sr.SysdynModelicaFunction_outputs, \r
+                            ListUtils.create(graph, outputResources));\r
                 }\r
-                graph.claim(\r
-                        function, \r
-                        sr.SysdynModelicaFunction_outputs, \r
-                        ListUtils.create(graph, outputResources));\r
                 \r
            }\r
 \r