diff --git a/src/xrpld/rpc/handlers/orderbook/GetAggregatePrice.cpp b/src/xrpld/rpc/handlers/orderbook/GetAggregatePrice.cpp index e6c7a160ad..ae551de1ab 100644 --- a/src/xrpld/rpc/handlers/orderbook/GetAggregatePrice.cpp +++ b/src/xrpld/rpc/handlers/orderbook/GetAggregatePrice.cpp @@ -51,7 +51,6 @@ iteratePriceData( std::shared_ptr const& sle, std::function const& f) { - using Meta = std::shared_ptr; static constexpr std::uint8_t kMaxHistory = 3; bool isNew = false; std::uint8_t history = 0; @@ -73,7 +72,7 @@ iteratePriceData( // for the Oracle is not found in the inner loop STObject const* prevChain = nullptr; - Meta meta = nullptr; + std::shared_ptr meta = nullptr; while (true) { if (prevChain == chain) @@ -93,6 +92,8 @@ iteratePriceData( return; // LCOV_EXCL_LINE meta = ledger->txRead(prevTx).second; + if (!meta) + return; prevChain = chain; for (STObject const& node : meta->getFieldArray(sfAffectedNodes))