[PSI] do not throw exception on incorrect expression in KtPsiFactory.createExpressionIfPossible
This commit is contained in:
@@ -69,7 +69,11 @@ class KtPsiFactory @JvmOverloads constructor(private val project: Project, val m
|
||||
}
|
||||
|
||||
fun createExpressionIfPossible(@NonNls text: String): KtExpression? {
|
||||
val expression = doCreateExpression(text) ?: return null
|
||||
val expression = try {
|
||||
doCreateExpression(text) ?: return null
|
||||
} catch (ignored: Throwable) {
|
||||
return null
|
||||
}
|
||||
return if (expression.text == text) expression else null
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user