diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java index 219678ffadbe..a4dc856755bd 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java @@ -1304,11 +1304,14 @@ public class BuildManager implements ApplicationComponent{ // this will ensure that we'll be able to obtain VirtualFile for existing roots CompilerUtil.refreshOutputDirectories(rootFiles, false); - final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex(); final LocalFileSystem lfs = LocalFileSystem.getInstance(); final Set filesToRefresh = new HashSet(); ApplicationManager.getApplication().runReadAction(new Runnable() { public void run() { + if (project.isDisposed()) { + return; + } + final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex(); for (File root : rootFiles) { final VirtualFile rootFile = lfs.findFileByIoFile(root); if (rootFile != null && fileIndex.isInSourceContent(rootFile)) {