From 8be451defde7d8eaed5199afb79545cf944e3797 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 24 Jun 2011 16:31:40 +0200 Subject: [PATCH] PY-3968 --- python/src/com/jetbrains/python/psi/impl/PyFileImpl.java | 2 +- .../jetbrains/python/psi/stubs/PyFromImportStatementStub.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/python/src/com/jetbrains/python/psi/impl/PyFileImpl.java b/python/src/com/jetbrains/python/psi/impl/PyFileImpl.java index c1d2b730a5c5..9b930e97cdc3 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyFileImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyFileImpl.java @@ -288,7 +288,7 @@ public class PyFileImpl extends PsiFileBase implements PyFile, PyExpression { // http://stackoverflow.com/questions/6048786/from-module-import-in-init-py-makes-module-name-visible if (PyNames.INIT_DOT_PY.equals(getName())) { final PyQualifiedName qName = stub.getImportSourceQName(); - if (qName.endsWith(name)) { + if (qName != null && qName.endsWith(name)) { final PsiElement element = PyUtil.turnInitIntoDir(ResolveImportUtil.resolveFromImportStatementSource(stub.getPsi())); if (element != null && element.getParent() == getContainingDirectory()) { return element; diff --git a/python/src/com/jetbrains/python/psi/stubs/PyFromImportStatementStub.java b/python/src/com/jetbrains/python/psi/stubs/PyFromImportStatementStub.java index ca14fc447d5d..e14e7d3e858a 100644 --- a/python/src/com/jetbrains/python/psi/stubs/PyFromImportStatementStub.java +++ b/python/src/com/jetbrains/python/psi/stubs/PyFromImportStatementStub.java @@ -3,11 +3,13 @@ package com.jetbrains.python.psi.stubs; import com.intellij.psi.stubs.StubElement; import com.jetbrains.python.psi.PyFromImportStatement; import com.jetbrains.python.psi.impl.PyQualifiedName; +import org.jetbrains.annotations.Nullable; /** * @author yole */ public interface PyFromImportStatementStub extends StubElement { + @Nullable PyQualifiedName getImportSourceQName(); boolean isStarImport(); int getRelativeLevel();