diff --git a/platform/lang-impl/src/com/intellij/openapi/components/impl/ModulePathMacroManager.java b/platform/lang-impl/src/com/intellij/openapi/components/impl/ModulePathMacroManager.java index a79c0645fec3..54c20f336f8e 100644 --- a/platform/lang-impl/src/com/intellij/openapi/components/impl/ModulePathMacroManager.java +++ b/platform/lang-impl/src/com/intellij/openapi/components/impl/ModulePathMacroManager.java @@ -86,12 +86,11 @@ public class ModulePathMacroManager extends BasePathMacroManager /*ProjectPathMa String macro = "$" + PathMacrosImpl.MODULE_DIR_MACRO_NAME + "$"; boolean check = false; - while (f != null) { + while (f != null && f.getParentFile() != null) { @NonNls String path = PathMacroMap.quotePath(f.getAbsolutePath()); String s = macro; if (StringUtil.endsWithChar(path, '/')) s += "/"; - if (path.equals("/")) break; putIfAbsent(result, "file://" + path, "file://" + s, check); putIfAbsent(result, "file:/" + path, "file:/" + s, check); diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/ProjectPathMacroManager.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/ProjectPathMacroManager.java index 225de01201a9..93fbcfa82204 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/ProjectPathMacroManager.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/ProjectPathMacroManager.java @@ -57,12 +57,11 @@ public class ProjectPathMacroManager extends BasePathMacroManager { String macro = "$" + PathMacrosImpl.PROJECT_DIR_MACRO_NAME + "$"; boolean check = false; - while (f != null) { + while (f != null && f.getParentFile() != null) { String path = PathMacroMap.quotePath(f.getAbsolutePath()); String s = macro; if (StringUtil.endsWithChar(path, '/')) s += "/"; - if (path.equals("/")) break; putIfAbsent(result, "file://" + path, "file://" + s, check); putIfAbsent(result, "file:/" + path, "file:/" + s, check);