From 79f377d0f0c97d25fcc2974cee5c79aed153d56c Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Fri, 29 Apr 2022 18:34:42 +0300 Subject: [PATCH] cli: ensure wallet is non-empty while changing password Close #2429. --- cli/wallet/wallet.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli/wallet/wallet.go b/cli/wallet/wallet.go index 8fabe443b..bbf044e6a 100644 --- a/cli/wallet/wallet.go +++ b/cli/wallet/wallet.go @@ -318,6 +318,9 @@ func changePassword(ctx *cli.Context) error { if err != nil { return cli.NewExitError(err, 1) } + if len(wall.Accounts) == 0 { + return cli.NewExitError("wallet has no accounts", 1) + } addrFlag := ctx.Generic("address").(*flags.Address) if addrFlag.IsSet { // Check for account presence first before asking for password.