Fix when nextValidLedger is null cause npe
@@ -1711,7 +1711,8 @@ public class ManagedCursorImpl implements ManagedCursor {
try {
long ledgerEntries = ledger.getLedgerInfo(markDeletePosition.getLedgerId()).get().getEntries();
Long nextValidLedger = ledger.getNextValidLedger(ledger.getLastConfirmedEntry().getLedgerId());
- shouldCursorMoveForward = (markDeletePosition.getEntryId() + 1 >= ledgerEntries)
+ shouldCursorMoveForward = nextValidLedger != null
+ && (markDeletePosition.getEntryId() + 1 >= ledgerEntries)
&& (newPosition.getLedgerId() == nextValidLedger);
} catch (Exception e) {
log.warn("Failed to get ledger entries while setting mark-delete-position", e);
