Skip to content

Commit 8295203

Browse files
committed
ethwallet#GetBalance: ensure provider is available, or error
1 parent 075a475 commit 8295203

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ethwallet/ethwallet.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ func (w *Wallet) GetBalance(ctx context.Context, optBlockNum ...*big.Int) (*big.
198198
if len(optBlockNum) > 0 {
199199
blockNum = optBlockNum[0]
200200
}
201+
provider := w.GetProvider()
202+
if provider == nil {
203+
return nil, fmt.Errorf("ethwallet: provider is not set")
204+
}
201205
return w.GetProvider().BalanceAt(ctx, w.Address(), blockNum)
202206
}
203207

0 commit comments

Comments
 (0)