From 11fe208fe6f7d132a89d9aacabb4f5339ad901cc Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 6 Sep 2012 13:52:06 +0200 Subject: [PATCH] more diagnostics for invalid offset (EA-38976) --- .../codeInsight/completion/CodeCompletionHandlerBase.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java index b4053b333198..358e97983172 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java @@ -563,7 +563,9 @@ public class CodeCompletionHandlerBase { Editor hostEditor, OffsetMap hostMap) { assert hostFile.isValid() : "file became invalid: " + hostFile.getClass(); - assert hostMap.getOffset(CompletionInitializationContext.START_OFFSET) < hostFile.getTextLength() : "startOffset outside the host file"; + if (hostMap.getOffset(CompletionInitializationContext.START_OFFSET) >= hostFile.getTextLength()) { + throw new AssertionError("startOffset outside the host file: " + hostMap.getOffset(CompletionInitializationContext.START_OFFSET) + "; " + hostFile); + } InjectedLanguageManager injectedLanguageManager = InjectedLanguageManager.getInstance(hostFile.getProject()); CompletionContext context;