[groovy] fix NPE warning in static import method fix

This commit is contained in:
Daniil Ovchinnikov
2016-12-26 18:02:20 +03:00
parent fc936e2e24
commit 35671de4cf
@@ -165,16 +165,15 @@ public class GroovyStaticImportMethodFix extends Intention {
private void doImport(final PsiMethod toImport) {
CommandProcessor.getInstance().executeCommand(toImport.getProject(), () -> WriteAction.run(() -> {
try {
GrMethodCall element = myMethodCall.getElement();
if (element != null) {
getMethodExpression(element).bindToElementViaStaticImport(toImport);
GrReferenceExpression expression = getMethodExpression();
if (expression != null) {
expression.bindToElementViaStaticImport(toImport);
}
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
}), getText(), this);
}
private void chooseAndImport(Editor editor) {