diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/SpecifyTypeInPy3AnnotationsIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/SpecifyTypeInPy3AnnotationsIntention.java index 82378cbd170f..f9cb3ae96c40 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/SpecifyTypeInPy3AnnotationsIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/SpecifyTypeInPy3AnnotationsIntention.java @@ -57,10 +57,13 @@ public class SpecifyTypeInPy3AnnotationsIntention implements IntentionAction { if (callExpression != null && callExpression.resolveCalleeFunction(PyResolveContext.defaultContext()) != null) { PyAssignmentStatement assignmentStatement = PsiTreeUtil.getParentOfType(elementAt, PyAssignmentStatement.class); if (assignmentStatement != null) { - PyType type = assignmentStatement.getAssignedValue().getType(TypeEvalContext.slow()); - if (type == null || type instanceof PyReturnTypeReference) { - myText = PyBundle.message("INTN.specify.returt.type.in.annotation"); - return true; + final PyExpression assignedValue = assignmentStatement.getAssignedValue(); + if (assignedValue != null) { + PyType type = assignedValue.getType(TypeEvalContext.slow()); + if (type == null || type instanceof PyReturnTypeReference) { + myText = PyBundle.message("INTN.specify.returt.type.in.annotation"); + return true; + } } } }