cli/wallet: do not panic if receiver is missing, fix #2210
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
fb31a81fd2
commit
e3ddbd28ae
2 changed files with 11 additions and 0 deletions
|
@ -116,6 +116,14 @@ func TestNEP17Transfer(t *testing.T) {
|
||||||
"--from", validatorAddr,
|
"--from", validatorAddr,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Run("missing receiver", func(t *testing.T) {
|
||||||
|
as := append([]string{}, args[:8]...)
|
||||||
|
as = append(as, args[10:]...)
|
||||||
|
e.In.WriteString("one\r")
|
||||||
|
e.RunWithError(t, as...)
|
||||||
|
e.In.Reset()
|
||||||
|
})
|
||||||
|
|
||||||
t.Run("InvalidPassword", func(t *testing.T) {
|
t.Run("InvalidPassword", func(t *testing.T) {
|
||||||
e.In.WriteString("onetwothree\r")
|
e.In.WriteString("onetwothree\r")
|
||||||
e.RunWithError(t, args...)
|
e.RunWithError(t, args...)
|
||||||
|
|
|
@ -514,6 +514,9 @@ func transferNEP(ctx *cli.Context, standard string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
toFlag := ctx.Generic("to").(*flags.Address)
|
toFlag := ctx.Generic("to").(*flags.Address)
|
||||||
|
if !toFlag.IsSet {
|
||||||
|
return cli.NewExitError(errors.New("missing receiver address (--to)"), 1)
|
||||||
|
}
|
||||||
to := toFlag.Uint160()
|
to := toFlag.Uint160()
|
||||||
token, err := getMatchingToken(ctx, wall, ctx.String("token"), standard)
|
token, err := getMatchingToken(ctx, wall, ctx.String("token"), standard)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue