diff --git a/apps/remix-ide/contracts/ballot.sol b/apps/remix-ide/contracts/ballot.sol index 1ebc747b44..aa49825fac 100644 --- a/apps/remix-ide/contracts/ballot.sol +++ b/apps/remix-ide/contracts/ballot.sol @@ -101,6 +101,7 @@ contract Ballot { Voter storage sender = voters[msg.sender]; require(sender.weight != 0, "Has no right to vote"); require(!sender.voted, "Already voted."); + require(proposal < proposals.length, "Invalid proposal index."); sender.voted = true; sender.vote = proposal;