From 55957297159cf428392a9750deddea3f210493ad Mon Sep 17 00:00:00 2001 From: anna Date: Mon, 27 Feb 2012 11:23:54 +0100 Subject: [PATCH] EA-32738 - SIOOBE: TextRange.substring --- .../codeInsight/navigation/actions/GotoDeclarationAction.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoDeclarationAction.java b/platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoDeclarationAction.java index f5cd8511e5cb..a03eb5f0a2c2 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoDeclarationAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoDeclarationAction.java @@ -146,7 +146,9 @@ public class GotoDeclarationAction extends BaseCodeInsightAction implements Code } if (elements.length > 1) { final TextRange range = reference.getRangeInElement(); - final String refText = range.substring(reference.getElement().getText()); + final String elementText = reference.getElement().getText(); + LOG.assertTrue(range.getStartOffset() >= 0 && range.getEndOffset() <= elementText.length(), reference); + final String refText = range.substring(elementText); String title = MessageFormat.format(titlePattern, refText); NavigationUtil.getPsiElementPopup(elements, new DefaultPsiElementCellRenderer(), title, processor).showInBestPositionFor(editor); return true;