From 7a295dd010f2db17bc8f73d1230c057bfab408e7 Mon Sep 17 00:00:00 2001 From: aryelciu001 Date: Wed, 1 Mar 2023 09:57:10 +0800 Subject: [PATCH] fix: check if poolInfo exists --- server/index.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server/index.ts b/server/index.ts index 0e9ed545..be574083 100644 --- a/server/index.ts +++ b/server/index.ts @@ -428,11 +428,14 @@ app.get( let claimableTokens = await getRewards(stakeAddress); const accountsInfo = await getAccountsInfo(stakeAddress); const poolInfo = await getPoolMetadata(accountsInfo[0]); - poolInfo.isWhitelisted = false; - const whitelist = TOSIFEE_WHITELIST ? TOSIFEE_WHITELIST.split(",") : []; - if (whitelist.includes(poolInfo.delegated_pool_id_bech32)) { - poolInfo.isWhitelisted = true; + if (poolInfo != null) { + poolInfo.isWhitelisted = false; + + const whitelist = TOSIFEE_WHITELIST ? TOSIFEE_WHITELIST.split(",") : []; + if (whitelist.includes(poolInfo.delegated_pool_id_bech32)) { + poolInfo.isWhitelisted = true; + } } const consolidatedGetRewards = {