From 2e827717144fb53b26ac6858f74f4399c5bc1f01 Mon Sep 17 00:00:00 2001 From: Tyler Sorensen Date: Wed, 6 May 2020 18:02:05 -0700 Subject: [PATCH] handle null value in getOptionVotingForRankedChoice --- packages/dai-plugin-governance/src/GovPollingService.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/dai-plugin-governance/src/GovPollingService.js b/packages/dai-plugin-governance/src/GovPollingService.js index 9a104aebb..5fcdb6791 100644 --- a/packages/dai-plugin-governance/src/GovPollingService.js +++ b/packages/dai-plugin-governance/src/GovPollingService.js @@ -85,6 +85,7 @@ export default class GovPollingService extends PrivateService { const optionIdRaw = await this.get( 'govQueryApi' ).getOptionVotingForRankedChoice(address.toLowerCase(), pollId); + if (!optionIdRaw) return []; const ballotBuffer = toBuffer(optionIdRaw, { endian: 'little' }); const ballot = paddedArray(32 - ballotBuffer.length, ballotBuffer); return ballot.reverse().filter(choice => choice !== 0 && choice !== '0');