Return an error when wallet is nil rather than panic (#6875)

This commit is contained in:
Preston Van Loon 2020-08-04 15:53:34 -07:00 committed by GitHub
parent 859e59b6f7
commit bc883aab9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,6 +58,9 @@ func CreateWallet(cliCtx *cli.Context) (*Wallet, error) {
} }
func createDirectKeymanagerWallet(cliCtx *cli.Context, wallet *Wallet) error { func createDirectKeymanagerWallet(cliCtx *cli.Context, wallet *Wallet) error {
if wallet == nil {
return errors.New("nil wallet")
}
if err := wallet.SaveWallet(); err != nil { if err := wallet.SaveWallet(); err != nil {
return errors.Wrap(err, "could not save wallet to disk") return errors.Wrap(err, "could not save wallet to disk")
} }