Check files is valid before searching for children (EA-113417)
This commit is contained in:
+1
-1
@@ -17,7 +17,6 @@ import com.intellij.openapi.project.rootManager
|
||||
import com.intellij.openapi.roots.ModuleRootEvent
|
||||
import com.intellij.openapi.roots.ModuleRootListener
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.vfs.InvalidVirtualFileAccessException
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.vfs.VirtualFileManager
|
||||
@@ -62,6 +61,7 @@ class KotlinPackageContentModificationListener(private val project: Project) {
|
||||
} else {
|
||||
events
|
||||
.asSequence()
|
||||
.filter { it.isValid }
|
||||
.filter { it.file != null }
|
||||
.filter(::isRelevant)
|
||||
.filter {
|
||||
|
||||
@@ -64,9 +64,11 @@ class ScriptTemplatesFromDependenciesProvider(private val project: Project) : Sc
|
||||
if (!processedRoots.contains(vfile)) {
|
||||
processedRoots.add(vfile)
|
||||
val root = JarFileSystem.getInstance().getJarRootForLocalFile(vfile) ?: vfile
|
||||
root.findFileByRelativePath(templatesPath)?.takeIf { it.isDirectory }?.children?.forEach {
|
||||
if (it.isValid && !it.isDirectory && templates.add(it.name)) {
|
||||
newTemplatesFound = true
|
||||
if (root.isValid) {
|
||||
root.findFileByRelativePath(templatesPath)?.takeIf { it.isDirectory }?.children?.forEach {
|
||||
if (it.isValid && !it.isDirectory && templates.add(it.name)) {
|
||||
newTemplatesFound = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user