From 4f916773c25a64e7b562c080363a7de4aaf6d2eb Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 7 Dec 2016 19:32:00 +0300 Subject: [PATCH] Add missing preparePsiElementForWrite() call --- .../jetbrains/kotlin/idea/inspections/RedundantIfInspection.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantIfInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantIfInspection.kt index 90ebe46cf29..bd84a153485 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantIfInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantIfInspection.kt @@ -16,6 +16,7 @@ package org.jetbrains.kotlin.idea.inspections +import com.intellij.codeInsight.CodeInsightUtil import com.intellij.codeInspection.* import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor @@ -92,6 +93,7 @@ class RedundantIfInspection : AbstractKotlinInspection(), CleanupLocalInspection override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val element = descriptor.psiElement as KtIfExpression + if (!CodeInsightUtil.preparePsiElementsForWrite(element)) return val condition = when (redundancyType) { RedundancyType.NONE -> return RedundancyType.THEN_TRUE -> element.condition!!