From 948779f507be6de226f28f32c1db7a800739e67f Mon Sep 17 00:00:00 2001 From: Ilia Zakoulov Date: Mon, 21 Oct 2024 13:47:44 +0200 Subject: [PATCH] PY-76629: PY-76714: Handle empty string of bundled stubs path findPathStringInHelpers might return an empty string, that will be equal to the home path, that will lead to indexing of the home directory. GitOrigin-RevId: e800896a4c0631844a7b7a3a79334c3853a30c32 --- python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java b/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java index b5af93220d9b..68c824b5e405 100644 --- a/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java +++ b/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java @@ -508,7 +508,11 @@ public final class PythonSdkUpdater { } private static @NotNull List getBundledStubs() { - VirtualFile bundledStubRoot = StandardFileSystems.local().findFileByPath(PythonHelpersLocator.findPathStringInHelpers("bundled_stubs")); + var helpersPath = PythonHelpersLocator.findPathStringInHelpers("bundled_stubs"); + if (helpersPath.isEmpty()) { + return Collections.emptyList(); + } + VirtualFile bundledStubRoot = StandardFileSystems.local().findFileByPath(helpersPath); if (bundledStubRoot == null) return Collections.emptyList(); return List.of(bundledStubRoot); }