diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Poll.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Poll.hs index 332df2f6c5..6f7f0ea2e8 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Poll.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Poll.hs @@ -129,7 +129,8 @@ runGovernanceAnswerPoll _ pollFile maybeChoice mOutFile = do validateChoice :: GovernancePoll -> Word -> ExceptT GovernanceCmdError IO () validateChoice GovernancePoll{govPollAnswers} ix = do let maxAnswerIndex = length govPollAnswers - 1 - when (fromIntegral ix > maxAnswerIndex) $ left $ + ixInt = fromIntegral ix + when (ixInt < 0 || ixInt > maxAnswerIndex) $ left $ GovernanceCmdPollOutOfBoundAnswer maxAnswerIndex askInteractively :: GovernancePoll -> ExceptT GovernanceCmdError IO Word