Skip to content

Commit

Permalink
fix to check it at empty flag
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Aug 23, 2024
1 parent 89e9eac commit e105fa7
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions cmd/move/move.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,22 +678,24 @@ func getBuildConfig(cmd *cobra.Command) (*types.CompilerBuildConfig, error) {
if err != nil {
return nil, err
}
namedAddressMap := make(map[string]types.AccountAddress)
for _, namedAddress := range strings.Split(namedAddresses, ",") {
v := strings.Split(namedAddress, "=")
if len(v) != 2 {
return nil, fmt.Errorf("invalid named-addresses: %s", namedAddresses)
}
if len(namedAddresses) > 0 {
namedAddressMap := make(map[string]types.AccountAddress)
for _, namedAddress := range strings.Split(namedAddresses, ",") {
v := strings.Split(namedAddress, "=")
if len(v) != 2 {
return nil, fmt.Errorf("invalid named-addresses: %s", namedAddresses)
}

name := v[0]
addr, err := types.NewAccountAddress(v[1]) // validate address
if err != nil {
return nil, fmt.Errorf("invalid address: %s", v[1])
}
name := v[0]
addr, err := types.NewAccountAddress(v[1]) // validate address
if err != nil {
return nil, fmt.Errorf("invalid address: %s", v[1])
}

namedAddressMap[name] = addr
namedAddressMap[name] = addr
}
options = append(options, buildtypes.WithNamedAddresses(namedAddressMap))
}
options = append(options, buildtypes.WithNamedAddresses(namedAddressMap))

bc := buildtypes.NewBuildConfig(options...)

Expand Down

0 comments on commit e105fa7

Please sign in to comment.