From 985af0e22250bcbd559dfdb200cba7120d996f2c Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Thu, 26 Sep 2013 14:34:11 -0700 Subject: [PATCH] Fix a case where tryAdvance can throw. --- src/ripple_app/ledger/LedgerMaster.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/ripple_app/ledger/LedgerMaster.cpp b/src/ripple_app/ledger/LedgerMaster.cpp index f715c8484..e0e1212b8 100644 --- a/src/ripple_app/ledger/LedgerMaster.cpp +++ b/src/ripple_app/ledger/LedgerMaster.cpp @@ -685,13 +685,20 @@ void LedgerMaster::advanceThread() } else { - for (int i = 0; i < getConfig().getSize(siLedgerFetch); ++i) - { - uint32 seq = missing - i; - uint256 hash = nextLedger->getLedgerHash(seq); - if (hash.isNonZero()) - getApp().getInboundLedgers().findCreate(hash, seq, false); - } + try + { + for (int i = 0; i < getConfig().getSize(siLedgerFetch); ++i) + { + uint32 seq = missing - i; + uint256 hash = nextLedger->getLedgerHash(seq); + if (hash.isNonZero()) + getApp().getInboundLedgers().findCreate(hash, seq, false); + } + } + catch (...) + { + WriteLog (lsWARNING, LedgerMaster) << "Threw while prefecthing"; + } } } else