Skip to content

Commit 22c19ea

Browse files
authored
Merge pull request #154 from dedis/front-fix-voters
Add checks on Voters state
2 parents 225e975 + 76f43cd commit 22c19ea

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

web/frontend/src/pages/election/Show.tsx

+7-4
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,12 @@ const ElectionShow: FC = () => {
180180
</div>
181181

182182
<div className="pt-2 break-all">Election ID : {electionId}</div>
183-
{status >= Status.Open && status <= Status.Canceled && (
184-
<div className="break-all">{t('numVotes', { num: voters.length })}</div>
185-
)}
183+
{status >= Status.Open &&
184+
status <= Status.Canceled &&
185+
voters !== null &&
186+
voters !== undefined && (
187+
<div className="break-all">{t('numVotes', { num: voters.length })}</div>
188+
)}
186189
<div className="py-6 pl-2">
187190
<div className="font-bold uppercase text-lg text-gray-700">{t('status')}</div>
188191
{DKGLoading && (
@@ -220,7 +223,7 @@ const ElectionShow: FC = () => {
220223
)}
221224
</div>
222225
</div>
223-
{voters.length > 0 && (
226+
{voters !== null && voters !== undefined && voters.length > 0 && (
224227
<div className="py-4 pl-2 pb-8">
225228
<div className="font-bold uppercase text-lg text-gray-700 pb-2">{t('userID')}</div>
226229
<div className="px-2">

0 commit comments

Comments
 (0)