From d51f54693fa19bc67ed94b9719da1e32c5d92535 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Mon, 25 Sep 2017 14:39:56 +0300 Subject: [PATCH] Exist if no identifier found (EA-91332) --- .../jetbrains/kotlin/psi/KtNamedDeclarationNotStubbed.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtNamedDeclarationNotStubbed.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtNamedDeclarationNotStubbed.java index eeec6006d0e..78653833884 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtNamedDeclarationNotStubbed.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtNamedDeclarationNotStubbed.java @@ -64,7 +64,10 @@ abstract class KtNamedDeclarationNotStubbed extends KtDeclarationImpl implements @Override public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException { - return getNameIdentifier().replace(KtPsiFactory(this).createNameIdentifier(name)); + PsiElement identifier = getNameIdentifier(); + if (identifier == null) throw new IncorrectOperationException(); + + return identifier.replace(KtPsiFactory(this).createNameIdentifier(name)); } @Override