* Add check and debug message for invalid line index.
This commit is contained in:
parent
6aba4c136f
commit
814f1307db
1 changed files with 5 additions and 0 deletions
|
@ -79,6 +79,11 @@ public final class Util {
|
|||
int to = Math.min(end.y + 1, lines.length);
|
||||
for (int i = start.y; i < to; i++) {
|
||||
int from = (i == start.y) ? start.x : 0;
|
||||
if (from < 0 || from > lines[i].length()) {
|
||||
System.err.println("Start index " + from + " out of range [0.." +
|
||||
lines[i].length() + "]");
|
||||
from = 0;
|
||||
}
|
||||
if (i == end.y && end.x < lines[i].length())
|
||||
buf.append(lines[i].substring(from, end.x));
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue