From b5f8ba4817a8a44d16e55ce667c69dce2e8ef145 Mon Sep 17 00:00:00 2001 From: Alan Cohen Date: Tue, 8 Sep 2015 15:47:03 -0700 Subject: [PATCH] Fix: Check for destination_currencies property Example stack: TypeError: Cannot read property 'join' of undefined at formatResponse (ripple-lib/dist/npm/api/ledger/pathfind.js:75:187) --- src/api/ledger/pathfind.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/ledger/pathfind.js b/src/api/ledger/pathfind.js index 39bab1a2..0af7f769 100644 --- a/src/api/ledger/pathfind.js +++ b/src/api/ledger/pathfind.js @@ -84,7 +84,8 @@ function formatResponse(pathfind, paths) { const address = pathfind.source.address; return parsePathfind(address, pathfind.destination.amount, paths); } - if (!_.includes(paths.destination_currencies, + if (paths.destination_currencies !== undefined && + !_.includes(paths.destination_currencies, pathfind.destination.amount.currency)) { throw new NotFoundError('No paths found. ' + 'The destination_account does not accept ' +