mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-15 03:55:18 +07:00
fix exception on select word when code block has no children (EA-64075 - AIOOBE: CodeBlockOrInitializerSelectioner.findClosingBrace)
This commit is contained in:
1 parent
5ca34b9263
commit
e53b863550
1 file changed
+7
-7
+7
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,14 +31,14 @@ public class CodeBlockOrInitializerSelectioner extends BasicSelectioner {
|
||||
@Override
|
||||
public List<TextRange> select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) {
|
||||
List<TextRange> result = new ArrayList<TextRange>();
|
||||
result.add(e.getTextRange());
|
||||
|
||||
PsiElement[] children = e.getChildren();
|
||||
|
||||
int start = findOpeningBrace(children);
|
||||
int end = findClosingBrace(children, start);
|
||||
|
||||
result.add(e.getTextRange());
|
||||
result.addAll(expandToWholeLine(editorText, new TextRange(start, end)));
|
||||
if (children.length > 0) {
|
||||
int start = findOpeningBrace(children);
|
||||
int end = findClosingBrace(children, start);
|
||||
result.addAll(expandToWholeLine(editorText, new TextRange(start, end)));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user