diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt index 04603b34661..fd4b4548289 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt @@ -96,6 +96,10 @@ object KotlinEvaluationBuilder: EvaluatorBuilder { throw EvaluateExceptionUtil.createEvaluateException("Couldn't evaluate kotlin expression in non-kotlin context") } + if (position.getLine() < 0) { + throw EvaluateExceptionUtil.createEvaluateException("Couldn't evaluate kotlin expression at $position") + } + if (codeFragment.getContext() !is JetElement) { val attachments = arrayOf(attachmentByPsiFile(position.getFile()), attachmentByPsiFile(codeFragment),