cli: ensure wallet is non-empty while changing password

Close #2429.
This commit is contained in:
Anna Shaleva 2022-04-29 18:34:42 +03:00
parent 19e4c679d3
commit 79f377d0f0

View file

@ -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.