Skip to content

Commit ae9edfb

Browse files
committed
Fixed index out of bound exception
1 parent 550697c commit ae9edfb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib-n-ide/src/main/java/com/duy/ide/editor/view/HighlightEditorView.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ public CharSequence filter(CharSequence source, final int start, final int end,
169169
//bad code
170170
//common support java,c and c++
171171
// TODO: 08-Jun-18 dynamic change
172-
if (dest.charAt(dend) == '}' && dstart - 1 >= 0 && dest.charAt(dstart - 1) == '{') {
172+
if (dend < dest.length() && dest.charAt(dend) == '}'
173+
&& dstart - 1 >= 0 && dest.charAt(dstart - 1) == '{') {
173174
int mstart = dstart - 2;
174175
while (mstart >= 0 && dest.charAt(mstart) != '\n') {
175176
mstart--;

0 commit comments

Comments
 (0)