Skip to content

Commit

Permalink
check for invalid style range lengths
Browse files Browse the repository at this point in the history
  • Loading branch information
koentsje committed Mar 20, 2014
1 parent 879090d commit 497167e
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ public void documentChanged(final DocumentEvent event) {
int lineCount = textWidget.getLineCount();
textWidget.setTopIndex(lineCount - 1);
StyleRange styleRange = aeshDocument.getCurrentStyleRange();
if (styleRange != null && event.getLength() == 0) {
if (styleRange != null &&
event.getLength() == 0 &&
styleRange.start <= getDocument().getLength() &&
styleRange.length >= 0 &&
styleRange.start + styleRange.length <= getDocument().getLength()) {
textWidget.setStyleRange(styleRange);
}
}
Expand Down

0 comments on commit 497167e

Please sign in to comment.