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)
This commit is contained in:
Alan Cohen
2015-09-08 15:47:03 -07:00
parent a53249ccd7
commit b5f8ba4817

View File

@@ -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 ' +