From 2584b6fc40046d14e1be93cf3921935c50fb470c Mon Sep 17 00:00:00 2001 From: mindcarver <32150062+mindcarver@users.noreply.github.com> Date: Fri, 27 Aug 2021 10:24:09 +0800 Subject: [PATCH] Fix nft-transfer bug (#2662) * fix nft-transfer bug * solve the problem of if nesting and err Co-authored-by: vincent --- cmd/iris/cmd/util.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cmd/iris/cmd/util.go b/cmd/iris/cmd/util.go index 54d377b05..48454719e 100644 --- a/cmd/iris/cmd/util.go +++ b/cmd/iris/cmd/util.go @@ -242,10 +242,21 @@ func (it coinConverter) parseFlags(cmd *cobra.Command, flag *pflag.Flag, cmdNm s } func (it coinConverter) parseArgs(cmd *cobra.Command, args []string) { + command, ok := it.cmds[cmd.Name()] + if !ok { + return + } + + if cmd.Parent().Name() != command.parentCmd { + return + } + if field, ok := it.getFromArgs(cmd.Name()); ok && len(args) > 0 { - if res, err := it.convertCoins(cmd, args[field.index]); err == nil { - args[field.index] = res + res, err := it.convertCoins(cmd, args[field.index]) + if err != nil { + return } + args[field.index] = res } }