]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Added a null-check to prevent crashing when fmu libraries cannot be found (refs ...
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 18 Jun 2012 08:35:15 +0000 (08:35 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 18 Jun 2012 08:35:15 +0000 (08:35 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@25195 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.modelica/src/org/simantics/modelica/fmi/FMUControlJNI.java

index 8069d97f7311cdb2fdd521f92b6b93174585cc90..2baca4ac21a1e8085a08e6fc58d6312cd9777f9d 100644 (file)
@@ -58,7 +58,6 @@ public class FMUControlJNI {
                                        String root = FileLocator.getBundleFile(bundle).getAbsolutePath();\r
                                        libraries[0] = new File(root, "libraries/zlibwapi.dll");\r
                                        libraries[1] = new File(root, "libraries/miniunz.dll");\r
-//                                     libraries[2] = new File(root, "libraries/FMUSim.dll");\r
                                        libraries[2] = new File(root, "libraries/FMUSimulator.dll");\r
                                }\r
                                catch (Exception e) {\r
@@ -68,9 +67,12 @@ public class FMUControlJNI {
                }\r
 \r
                for(File library : libraries) {\r
-                       if(!library.isFile()) {\r
+                       if(library == null) {\r
+                               System.err.println("FMU library not loaded. FMU simulation not working.");\r
+                               continue;\r
+                       } else if(!library.isFile()) {\r
                                System.err.println(library.getAbsolutePath() + " not found");\r
-                       } else if(library != null) {\r
+                       } else {\r
                                try {\r
                                        System.load(library.getAbsolutePath());\r
                                } catch (Throwable t) {\r