Skip to content

Commit 7b948ee

Browse files
committed
Fix StringIndexOutOfBounds
1 parent 06099f8 commit 7b948ee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/gs/mclo/java/Log.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ private boolean isWhitelistedIPv6(String s) {
174174
* limit the log length to 10 MB
175175
*/
176176
private void filterLength() {
177-
this.content = this.content.trim().substring(0, MAX_LOG_LENGTH);
177+
this.content = this.content.trim();
178+
this.content = this.content.substring(0, Math.min(this.content.length(), MAX_LOG_LENGTH));
178179
}
179180

180181
/**

0 commit comments

Comments
 (0)