From 55b2a7d0517950f7fbf715a7a0fa2ef36937c1fe Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Tue, 9 Apr 2019 14:44:08 +0300 Subject: [PATCH] Fix NPE in surround (EA-141193) --- .../surroundWith/statement/KotlinIfSurrounderBase.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/idea/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfSurrounderBase.java b/idea/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfSurrounderBase.java index 8f3cf46d838..95036a06d85 100644 --- a/idea/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfSurrounderBase.java +++ b/idea/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfSurrounderBase.java @@ -62,6 +62,9 @@ public abstract class KotlinIfSurrounderBase extends KotlinStatementsSurrounder container.deleteChildRange(statements[0], statements[statements.length - 1]); ifExpression = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(ifExpression); + if (ifExpression == null) { + return null; + } return getRange(editor, ifExpression); }