fixed PY-7974 NPE at com.jetbrains.python.codeInsight.intentions.SpecifyTypeInPy3AnnotationsIntention.isAvailable

This commit is contained in:
Ekaterina Tuzova
2012-11-08 13:25:18 +04:00
parent e211ddf570
commit 184ff41405
@@ -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;
}
}
}
}