don't add SDK if setupSdk() failed (PY-1285)
authorDmitry Jemerov <yole@jetbrains.com>
Fri, 16 Jul 2010 13:25:23 +0000 (17:25 +0400)
committerDmitry Jemerov <yole@jetbrains.com>
Fri, 16 Jul 2010 15:03:49 +0000 (19:03 +0400)
platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/SdkConfigurationUtil.java

index 02781b67985f2fc1e72aa352bc73585366a5861d..ba29ba95d3f3060c22c60a654328fa1235b8aee1 100644 (file)
@@ -106,7 +106,7 @@ public class SdkConfigurationUtil {
     return descriptor;
   }
 
     return descriptor;
   }
 
-  public static void addSdk(final Sdk sdk) {
+  public static void addSdk(@NotNull final Sdk sdk) {
     ApplicationManager.getApplication().runWriteAction(new Runnable() {
       @Override
       public void run() {
     ApplicationManager.getApplication().runWriteAction(new Runnable() {
       @Override
       public void run() {
@@ -213,7 +213,9 @@ public class SdkConfigurationUtil {
         });
         if (sdkHome != null) {
           final Sdk newSdk = setupSdk(ProjectJdkTable.getInstance().getAllJdks(), sdkHome, sdkType, true, null, null);
         });
         if (sdkHome != null) {
           final Sdk newSdk = setupSdk(ProjectJdkTable.getInstance().getAllJdks(), sdkHome, sdkType, true, null, null);
-          addSdk(newSdk);
+          if (newSdk != null) {
+            addSdk(newSdk);
+          }
           return newSdk;
         }
       }
           return newSdk;
         }
       }