Skip to content

Commit

Permalink
Fix segmentation fault in GetMagnitudeWeightFactor
Browse files Browse the repository at this point in the history
GetMagnitudeWeightFactor should return zero if index argument is
a nullptr.
  • Loading branch information
jamescowens committed Nov 3, 2024
1 parent 2d404ac commit 827f452
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/gridcoin/voting/poll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ int64_t Poll::Expiration() const

Fraction Poll::ResolveMagnitudeWeightFactor(CBlockIndex *index) const
{
if (index == nullptr) {
return Fraction();
}

Fraction magnitude_weight_factor = Params().GetConsensus().DefaultMagnitudeWeightFactor;

// Before V13 magnitude weight factor is 1 / 5.67.
Expand Down

0 comments on commit 827f452

Please sign in to comment.