Skip to content

Commit

Permalink
Merge pull request #11677 from vegaprotocol/nil-ptr-fix
Browse files Browse the repository at this point in the history
fix: check for nil values before dereferencing
  • Loading branch information
jeremyletang authored Sep 12, 2024
2 parents b31dff0 + 9c6f432 commit 2a7b888
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions datanode/service/party_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ func (s *PSvc) GetPartyStats(ctx context.Context, partyID string, markets []stri
if err := addRefFeeFactors(&pfFactors, refStats[0]); err != nil {
return nil, err
}
data.ReferralDiscountTier = *tier.TierNumber
if tier != nil {
data.ReferralDiscountTier = *tier.TierNumber
}
}
// 2. volume discount stats.
vdStats, _, err := s.vds.Stats(ctx, &lastE, &partyID, entities.DefaultCursorPagination(true))
Expand All @@ -148,7 +150,9 @@ func (s *PSvc) GetPartyStats(ctx context.Context, partyID string, markets []stri
if err := addVolFeeFactors(&pfFactors, vdStats[0]); err != nil {
return nil, err
}
data.VolumeDiscountTier = *tier.TierNumber
if tier != nil {
data.VolumeDiscountTier = *tier.TierNumber
}
}
// 3. Volume Rebate stats.
vrStats, _, err := s.vrs.Stats(ctx, &lastE, &partyID, entities.DefaultCursorPagination(true))
Expand All @@ -165,7 +169,9 @@ func (s *PSvc) GetPartyStats(ctx context.Context, partyID string, markets []stri
return nil, err
}
pfFactors.rebate = rebate
data.VolumeRebateTier = *tier.TierNumber
if tier != nil {
data.VolumeRebateTier = *tier.TierNumber
}
}
for _, mkt := range mkts {
// @TODO ensure non-nil slice!
Expand Down

0 comments on commit 2a7b888

Please sign in to comment.