mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-7974 NPE at com.jetbrains.python.codeInsight.intentions.SpecifyTypeInPy3AnnotationsIntention.isAvailable
This commit is contained in:
+7
-4
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user