Skip to content

Commit 61470d7

Browse files
author
Richard Patel
committed
fix nil pointer deref when publisher does not exist
1 parent 4f7fe9d commit 61470d7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

balance.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ func (b *balanceScraper) update(ctx context.Context) {
5959
return
6060
}
6161
for i, acc := range res.Value {
62+
var balance float64
63+
if acc != nil {
64+
balance = float64(acc.Lamports)
65+
}
6266
b.GaugeVec.
6367
WithLabelValues(b.publishers[i].String()).
64-
Set(float64(acc.Lamports))
68+
Set(balance)
6569
}
6670
}

0 commit comments

Comments
 (0)