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