]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.osgi/src/org/simantics/scl/osgi/internal/BundleModuleSource.java
Prevent NPE if the path to the module source cannot be found
[simantics/platform.git] / bundles / org.simantics.scl.osgi / src / org / simantics / scl / osgi / internal / BundleModuleSource.java
index af6af0872163a8e3ec6be21461becc5c90199c68..fc9799de706d6625e401d47dd3320aa7a900cc91 100644 (file)
@@ -146,7 +146,10 @@ public class BundleModuleSource extends EncodedTextualModuleSource implements Up
     @Override
     public boolean isUpdateable() {
         try {
-            return Files.exists(getPath());
+            Path path = getPath();
+            if(path == null)
+                return false;
+            return Files.exists(path);
         } catch (IOException e) {
             return false;
         }
@@ -156,6 +159,8 @@ public class BundleModuleSource extends EncodedTextualModuleSource implements Up
     public void update(String newSourceText) {
         try {
             Path path = getPath();
+            if(path == null)
+                return;
             Files.write(path, newSourceText.getBytes(Charset.forName("UTF-8")));
         } catch(IOException e) {
             e.printStackTrace();