From e40791ec88e4cf0edd95fa79c78128df52026c7e Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Wed, 14 Oct 2020 22:17:09 +0300 Subject: [PATCH] PY-44026 Fix IOOBE in the GlobalSearchScope, causing repeated reindexing GitOrigin-RevId: ed38aec8490d51982f8f326b21714c496a0ed576 --- .../python/psi/stubs/PyQualifiedNameCompletionMatcher.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/python-psi-impl/src/com/jetbrains/python/psi/stubs/PyQualifiedNameCompletionMatcher.java b/python/python-psi-impl/src/com/jetbrains/python/psi/stubs/PyQualifiedNameCompletionMatcher.java index 3c3a262b1594..f01a764c3e63 100644 --- a/python/python-psi-impl/src/com/jetbrains/python/psi/stubs/PyQualifiedNameCompletionMatcher.java +++ b/python/python-psi-impl/src/com/jetbrains/python/psi/stubs/PyQualifiedNameCompletionMatcher.java @@ -212,7 +212,8 @@ public class PyQualifiedNameCompletionMatcher { VirtualFile closestRoot = findClosestRoot(nameAnchor, projectFileIndex); if (closestRoot == null) return null; String relativePath = VfsUtilCore.getRelativePath(nameAnchor, closestRoot); - if (relativePath == null) return null; + // A relative path can be empty in case of __init__.py directly inside a root. + if (relativePath == null || relativePath.isEmpty()) return null; return convertPathToImportableQualifiedName(relativePath); }