Skip to content

Commit

Permalink
Handle no lens results
Browse files Browse the repository at this point in the history
  • Loading branch information
IanWoodard committed Feb 24, 2024
1 parent dbad2eb commit 62f84e2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion earn/src/data/BorrowerNft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ export async function fetchListOfBorrowerNfts(
tryAggregate: true,
multicallCustomContractAddress: MULTICALL_ADDRESS[chainId],
});
const lensResults = (await multicall.call(lensContext)).results['lens'].callsReturnContext;
const lensResults = (await multicall.call(lensContext))?.results['lens']?.callsReturnContext;
// Return early if there are no results
if (!lensResults.length) return [];
if (lensResults.find((v) => !v.success || !v.decoded)) {
throw new Error('Multicall error while checking whether Borrowers are in use');
}
Expand Down

0 comments on commit 62f84e2

Please sign in to comment.