Minor: do not assert psi state in RemoveUselessIsCheckFixForWhen
This commit is contained in:
@@ -29,8 +29,8 @@ class RemoveUselessIsCheckFixForWhen(element: KtWhenConditionIsPattern) : Kotlin
|
|||||||
|
|
||||||
override fun invoke(project: Project, editor: Editor?, file: KtFile) {
|
override fun invoke(project: Project, editor: Editor?, file: KtFile) {
|
||||||
val condition = element ?: return
|
val condition = element ?: return
|
||||||
val whenEntry = condition.parent as KtWhenEntry
|
val whenEntry = condition.parent as? KtWhenEntry ?: return
|
||||||
val whenExpression = whenEntry.parent as KtWhenExpression
|
val whenExpression = whenEntry.parent as? KtWhenExpression ?: return
|
||||||
|
|
||||||
if (condition.isNegated) {
|
if (condition.isNegated) {
|
||||||
condition.parent.delete()
|
condition.parent.delete()
|
||||||
|
|||||||
Reference in New Issue
Block a user