Fix KNPE in introduce new variable (EA-131176)
This commit is contained in:
@@ -154,8 +154,8 @@ fun selectElementsWithTargetParent(
|
|||||||
selectSingleElement()
|
selectSingleElement()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun PsiElement.findExpressionByCopyableDataAndClearIt(key: Key<Boolean>): KtExpression {
|
fun PsiElement.findExpressionByCopyableDataAndClearIt(key: Key<Boolean>): KtExpression? {
|
||||||
val result = findDescendantOfType<KtExpression> { it.getCopyableUserData(key) != null }!!
|
val result = findDescendantOfType<KtExpression> { it.getCopyableUserData(key) != null } ?: return null
|
||||||
result.putCopyableUserData(key, null)
|
result.putCopyableUserData(key, null)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -324,7 +324,7 @@ object KotlinIntroduceVariableHandler : RefactoringActionHandler {
|
|||||||
} ?: newReplace
|
} ?: newReplace
|
||||||
}
|
}
|
||||||
|
|
||||||
runRefactoring(isVar, newExpression, newCommonContainer, newCommonParent, newAllReplaces)
|
runRefactoring(isVar, newExpression ?: return, newCommonContainer, newCommonParent, newAllReplaces)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user