Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check for nil values before dereferencing #11677

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading