]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
refs #5224
authorvillberg <villberg@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 26 Aug 2014 04:53:28 +0000 (04:53 +0000)
committervillberg <villberg@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 26 Aug 2014 04:53:28 +0000 (04:53 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@30132 ac1ea38d-2e2b-0410-8846-a27921b304fc

fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Parser.java

index e2c722d75702dbc561d1da36c69f9842f7a6b062..f9a177303a3af98216929fc1d964f95a9b6d6820 100644 (file)
@@ -382,20 +382,22 @@ public class Parser {
                                                }\r
                                        }\r
                                }\r
-                               ArrayList<Object> declarations = (ArrayList<Object>)composition.get(0);\r
-                               for(Object os_ : declarations) {\r
-                                       if(os_ instanceof VariableDeclaration) {\r
-                                               VariableDeclaration decl = (VariableDeclaration)os_;\r
-                                               if("input".equals(decl.direction)) function.inputs.add(decl);\r
-                                               else if ("output".equals(decl.direction)) function.outputs.add(decl);\r
-                                               else throw new IllegalStateException();\r
-                                       } else {\r
-                                               ArrayList<Object> os = (ArrayList<Object>)os_;\r
-                                               for(Object o : os) {\r
-                                                       VariableDeclaration decl = (VariableDeclaration)o;\r
+                               if(!composition.isEmpty()) {\r
+                                       ArrayList<Object> declarations = (ArrayList<Object>)composition.get(0);\r
+                                       for(Object os_ : declarations) {\r
+                                               if(os_ instanceof VariableDeclaration) {\r
+                                                       VariableDeclaration decl = (VariableDeclaration)os_;\r
                                                        if("input".equals(decl.direction)) function.inputs.add(decl);\r
                                                        else if ("output".equals(decl.direction)) function.outputs.add(decl);\r
                                                        else throw new IllegalStateException();\r
+                                               } else {\r
+                                                       ArrayList<Object> os = (ArrayList<Object>)os_;\r
+                                                       for(Object o : os) {\r
+                                                               VariableDeclaration decl = (VariableDeclaration)o;\r
+                                                               if("input".equals(decl.direction)) function.inputs.add(decl);\r
+                                                               else if ("output".equals(decl.direction)) function.outputs.add(decl);\r
+                                                               else throw new IllegalStateException();\r
+                                                       }\r
                                                }\r
                                        }\r
                                }\r