nil check when dereferencing voteSet.votes

This commit is contained in:
William Banfield
2022-01-13 16:56:37 -05:00
parent d48f40e6f7
commit fd938b4918
+3 -1
View File
@@ -385,7 +385,9 @@ func (voteSet *VoteSet) List() []Vote {
}
votes := make([]Vote, len(voteSet.votes))
for i := range voteSet.votes {
votes[i] = *voteSet.votes[i]
if voteSet.votes[i] != nil {
votes[i] = *voteSet.votes[i]
}
}
return votes
}