Skip to content

Commit

Permalink
fix npe in ManagedLedgerImpl (apache#14481)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3da048c)
  • Loading branch information
lordcheng10 authored and codelipenghui committed Mar 1, 2022
1 parent 0bbf05b commit 43a9b6f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3252,9 +3252,11 @@ public PositionImpl getPositionAfterN(final PositionImpl startPosition, long n,
totalEntriesInCurrentLedger = 0;
}
} else {
totalEntriesInCurrentLedger = ledgers.get(currentLedgerId).getEntries();
LedgerInfo ledgerInfo = ledgers.get(currentLedgerId);
totalEntriesInCurrentLedger = ledgerInfo != null ? ledgerInfo.getEntries() : 0;
}


long unreadEntriesInCurrentLedger = totalEntriesInCurrentLedger - currentEntryId;

if (unreadEntriesInCurrentLedger >= entriesToSkip) {
Expand Down

0 comments on commit 43a9b6f

Please sign in to comment.