From 726df60c969f406711ff89c93c6f4f1a4897724c Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Thu, 3 Dec 2009 23:02:37 +0300 Subject: [PATCH] assertion added: RunConfiguration should not return null modules in module array --- .../src/com/intellij/compiler/impl/ModuleCompileScope.java | 3 +++ .../com/intellij/compiler/options/CompileStepBeforeRun.java | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/ModuleCompileScope.java b/java/compiler/impl/src/com/intellij/compiler/impl/ModuleCompileScope.java index 1f27bc9a33..7a21af6af0 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/ModuleCompileScope.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/ModuleCompileScope.java @@ -61,6 +61,9 @@ public class ModuleCompileScope extends FileIndexCompileScope { myProject = project; myScopeModules = new HashSet(); for (Module module : modules) { + if (module == null) { + continue; // prevent NPE + } if (includeDependentModules) { buildScopeModulesSet(module); } diff --git a/java/execution/impl/src/com/intellij/compiler/options/CompileStepBeforeRun.java b/java/execution/impl/src/com/intellij/compiler/options/CompileStepBeforeRun.java index f4204cdeb0..d165861a02 100644 --- a/java/execution/impl/src/com/intellij/compiler/options/CompileStepBeforeRun.java +++ b/java/execution/impl/src/com/intellij/compiler/options/CompileStepBeforeRun.java @@ -28,6 +28,7 @@ import com.intellij.openapi.compiler.CompileContext; import com.intellij.openapi.compiler.CompileScope; import com.intellij.openapi.compiler.CompileStatusNotification; import com.intellij.openapi.compiler.CompilerManager; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; @@ -40,6 +41,7 @@ import org.jetbrains.annotations.Nullable; * @author spleaner */ public class CompileStepBeforeRun extends BeforeRunTaskProvider { + private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.options.CompileStepBeforeRun"); public static final Key ID = Key.create("Make"); private static final Key RUN_CONFIGURATION = Key.create("RUN_CONFIGURATION"); @@ -98,6 +100,14 @@ public class CompileStepBeforeRun extends BeforeRunTaskProvider 0) { + for (Module module : modules) { + if (module == null) { + LOG.assertTrue( + false, + "RunConfiguration should not return null modules. Configuration=" + runConfiguration.getName() + "; class=" + runConfiguration.getClass().getName() + ); + } + } scope = compilerManager.createModulesCompileScope(modules, true); } else { -- 2.11.4.GIT