Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
handle null value in getOptionVotingForRankedChoice
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler17 committed May 7, 2020
1 parent 2754abb commit 2e82771
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/dai-plugin-governance/src/GovPollingService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 2e82771

Please sign in to comment.