mirror of
https://github.com/ChuckNorrison/LightningTipBot.git
synced 2026-08-17 13:07:16 +02:00
Merge pull request #365 from LightningTipBot/fix/wallet_check
check wallet nil before balance check
This commit is contained in:
commit
4ecc65fb27
1 changed files with 4 additions and 0 deletions
|
|
@ -71,6 +71,10 @@ func (bot *TipBot) GetUserBalanceCached(user *lnbits.User) (amount int64, err er
|
|||
}
|
||||
|
||||
func (bot *TipBot) GetUserBalance(user *lnbits.User) (amount int64, err error) {
|
||||
if user.Wallet == nil {
|
||||
return 0, errors.New("User has no wallet")
|
||||
}
|
||||
|
||||
wallet, err := bot.Client.Info(*user.Wallet)
|
||||
if err != nil {
|
||||
errmsg := fmt.Sprintf("[GetUserBalance] Error: Couldn't fetch user %s's info from LNbits: %s", GetUserStr(user.Telegram), err.Error())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue