Fix a bounds check problem in IndentingWriter

This commit is contained in:
Ben Gruver 2015-03-20 16:39:07 -07:00 committed by Connor Tumbleson
parent fa773b5382
commit 90e6923ae7

View File

@ -120,7 +120,7 @@ public class IndentingWriter extends Writer {
int pos = start; int pos = start;
while (pos < end) { while (pos < end) {
pos = str.indexOf('\n', start); pos = str.indexOf('\n', start);
if (pos == -1) { if (pos == -1 || pos >= end) {
writeLine(str, start, end-start); writeLine(str, start, end-start);
return; return;
} else { } else {