diff --git a/source/com/intellij/codeInsight/editorActions/SelectWordUtil.java b/source/com/intellij/codeInsight/editorActions/SelectWordUtil.java index 7ff47096713e..4334b76430b1 100644 --- a/source/com/intellij/codeInsight/editorActions/SelectWordUtil.java +++ b/source/com/intellij/codeInsight/editorActions/SelectWordUtil.java @@ -295,6 +295,7 @@ public class SelectWordUtil { } private static TextRange getWordSelectionRange(CharSequence editorText, int cursorOffset) { + if (editorText.length() == 0) return null; if (cursorOffset > 0 && !Character.isJavaIdentifierPart(editorText.charAt(cursorOffset)) && Character.isJavaIdentifierPart(editorText.charAt(cursorOffset - 1))) { cursorOffset--;