IDEADEV-41783 Exception when adding module library with no content [r=ann]
authorAlexey Pegov <alexey.pegov@jetbrains.com>
Wed, 2 Dec 2009 14:42:26 +0000 (17:42 +0300)
committerAlexey Pegov <alexey.pegov@jetbrains.com>
Wed, 2 Dec 2009 14:42:26 +0000 (17:42 +0300)
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryEditor.java

index 90126587152f802123194856dd17f7db4ce0dfe5..a14a4e827b993d508640ecb6e021110eb1db0c87 100644 (file)
@@ -42,6 +42,10 @@ public class LibraryEditor implements Disposable {
   }
 
   public void dispose() {
+    if (myModel != null) {
+      // dispose if wasn't committed
+      Disposer.dispose(myModel);
+    }
   }
 
   public String[] getUrls(OrderRootType rootType) {
@@ -96,7 +100,6 @@ public class LibraryEditor implements Disposable {
   public Library.ModifiableModel getModel() {
     if (myModel == null) {
       myModel = myLibrary.getModifiableModel();
-      Disposer.register(this, myModel);
     }
     return myModel;
   }