consensus: add some more checks to vote counting (#7253)

This commit is contained in:
Callum Waters
2021-11-09 10:51:19 +01:00
committed by GitHub
parent 1e701ed9b5
commit b3b90f820c
2 changed files with 10 additions and 1 deletions
+3
View File
@@ -372,6 +372,9 @@ func (voteSet *VoteSet) GetByIndex(valIndex int32) *Vote {
}
voteSet.mtx.Lock()
defer voteSet.mtx.Unlock()
if int(valIndex) >= len(voteSet.votes) {
return nil
}
return voteSet.votes[valIndex]
}