Fixed possible ArrayIndexOutOfBounds exception

This commit is contained in:
Seth Goings 2011-09-01 09:11:39 -06:00
parent c75b06ddc1
commit 97e03b9f28

View File

@ -45,7 +45,7 @@ public class BufferedReader extends Reader {
if (buffer[i] == '\n' || buffer[i] == '\r') {
sb.append(buffer, position, i - position);
position = i + 1;
if(buffer[i+1] != null && buffer[i+1] == '\n') {
if(i+1 < limit && buffer[i+1] == '\n') {
position = i + 1;
}
return sb.toString();