Check files is valid before searching for children (EA-113417)

This commit is contained in:
Nikolay Krasko
2018-06-27 13:00:05 +03:00
parent 8c8d0eefbb
commit c68284030d
2 changed files with 6 additions and 4 deletions
@@ -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
}
}
}
}