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