From e8e0d8bd82c614528e470f64ac00106ab67ee597 Mon Sep 17 00:00:00 2001 From: Shawn Xie Date: Sat, 4 Mar 2023 12:33:24 -0500 Subject: [PATCH] add size guard --- src/ripple/rpc/impl/NFTokenID.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ripple/rpc/impl/NFTokenID.cpp b/src/ripple/rpc/impl/NFTokenID.cpp index a4d2f225ea8..7649831005e 100644 --- a/src/ripple/rpc/impl/NFTokenID.cpp +++ b/src/ripple/rpc/impl/NFTokenID.cpp @@ -165,7 +165,9 @@ insertNFTokenID( if (auto const type = transaction->getTxnType(); type == ttNFTOKEN_MINT) { getNFTokenIDFromPage(transactionMeta, tokenIDResult); - response[jss::nftoken_id] = to_string(tokenIDResult.front()); + + if (tokenIDResult.size() > 0) + response[jss::nftoken_id] = to_string(tokenIDResult.front()); } else if (type == ttNFTOKEN_ACCEPT_OFFER) { @@ -173,7 +175,8 @@ insertNFTokenID( // In brokered mode, there will be a duplicate NFTokenID in the // vector, but we don't have to do anything special here. - response[jss::nftoken_id] = to_string(tokenIDResult.front()); + if (tokenIDResult.size() > 0) + response[jss::nftoken_id] = to_string(tokenIDResult.front()); } else if (type == ttNFTOKEN_CANCEL_OFFER) {