Skip to content

Commit

Permalink
fix: Fixed array out-of-bounds exceptions caused by messages not present
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghuaiyuan committed Jan 11, 2025
1 parent 119a0be commit b22866b
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ public CompletableFuture<ByteBuffer> readAsync(long offset, int length) {
}
}

if (index < 0) {
log.error("FlatAppendFile#readAsync offset={} is lower than minimum offset:{}", offset, fileSegmentList.get(0).getBaseOffset());
return CompletableFuture.completedFuture(null);
}

FileSegment fileSegment1 = fileSegmentList.get(index);
FileSegment fileSegment2 = offset + length > fileSegment1.getCommitOffset() &&
fileSegmentList.size() > index + 1 ? fileSegmentList.get(index + 1) : null;
Expand Down

0 comments on commit b22866b

Please sign in to comment.