From: lempinen Date: Mon, 18 Jun 2012 08:35:15 +0000 (+0000) Subject: Added a null-check to prevent crashing when fmu libraries cannot be found (refs ... X-Git-Tag: simantics-1.7~26 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=7d76fba6e9e8f96ecb402386e6c5e43099bc4dec;p=simantics%2Fsysdyn.git Added a null-check to prevent crashing when fmu libraries cannot be found (refs #3398) git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@25195 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.modelica/src/org/simantics/modelica/fmi/FMUControlJNI.java b/org.simantics.modelica/src/org/simantics/modelica/fmi/FMUControlJNI.java index 8069d97f..2baca4ac 100644 --- a/org.simantics.modelica/src/org/simantics/modelica/fmi/FMUControlJNI.java +++ b/org.simantics.modelica/src/org/simantics/modelica/fmi/FMUControlJNI.java @@ -58,7 +58,6 @@ public class FMUControlJNI { String root = FileLocator.getBundleFile(bundle).getAbsolutePath(); libraries[0] = new File(root, "libraries/zlibwapi.dll"); libraries[1] = new File(root, "libraries/miniunz.dll"); -// libraries[2] = new File(root, "libraries/FMUSim.dll"); libraries[2] = new File(root, "libraries/FMUSimulator.dll"); } catch (Exception e) { @@ -68,9 +67,12 @@ public class FMUControlJNI { } for(File library : libraries) { - if(!library.isFile()) { + if(library == null) { + System.err.println("FMU library not loaded. FMU simulation not working."); + continue; + } else if(!library.isFile()) { System.err.println(library.getAbsolutePath() + " not found"); - } else if(library != null) { + } else { try { System.load(library.getAbsolutePath()); } catch (Throwable t) {