Skip to content

Commit

Permalink
[fix][ml] Avoid NPE when getCurrentLedger() returns null
Browse files Browse the repository at this point in the history
  • Loading branch information
lhotari committed Mar 5, 2025
1 parent 0cc266d commit 09c29bc
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3826,7 +3826,8 @@ static long estimateEntryCountBySize(long bytesSize, Position readPosition, Mana

while (remainingBytesSize > 0) {
// Last ledger.
if (posToRead.getLedgerId() == ml.getCurrentLedger().getId()) {
LedgerHandle currentLedger = ml.getCurrentLedger();
if (currentLedger != null && posToRead.getLedgerId() == currentLedger.getId()) {
if (ml.getCurrentLedgerSize() == 0 || ml.getCurrentLedgerEntries() == 0) {
// Only read 1 entry if no entries to read.
return 1;
Expand Down

0 comments on commit 09c29bc

Please sign in to comment.