From ce1fbdac2ca6fd078e554d0226c72fb9a355f9bd Mon Sep 17 00:00:00 2001 From: villberg Date: Tue, 26 Aug 2014 04:53:28 +0000 Subject: [PATCH] refs #5224 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@30132 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../src/fi/semantum/sysdyn/solver/Parser.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Parser.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Parser.java index e2c722d7..f9a17730 100644 --- a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Parser.java +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Parser.java @@ -382,20 +382,22 @@ public class Parser { } } } - ArrayList declarations = (ArrayList)composition.get(0); - for(Object os_ : declarations) { - if(os_ instanceof VariableDeclaration) { - VariableDeclaration decl = (VariableDeclaration)os_; - if("input".equals(decl.direction)) function.inputs.add(decl); - else if ("output".equals(decl.direction)) function.outputs.add(decl); - else throw new IllegalStateException(); - } else { - ArrayList os = (ArrayList)os_; - for(Object o : os) { - VariableDeclaration decl = (VariableDeclaration)o; + if(!composition.isEmpty()) { + ArrayList declarations = (ArrayList)composition.get(0); + for(Object os_ : declarations) { + if(os_ instanceof VariableDeclaration) { + VariableDeclaration decl = (VariableDeclaration)os_; if("input".equals(decl.direction)) function.inputs.add(decl); else if ("output".equals(decl.direction)) function.outputs.add(decl); else throw new IllegalStateException(); + } else { + ArrayList os = (ArrayList)os_; + for(Object o : os) { + VariableDeclaration decl = (VariableDeclaration)o; + if("input".equals(decl.direction)) function.inputs.add(decl); + else if ("output".equals(decl.direction)) function.outputs.add(decl); + else throw new IllegalStateException(); + } } } } -- 2.47.1