File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -89,15 +89,20 @@ func loopOut(ctx *cli.Context) error {
89
89
return err
90
90
}
91
91
92
- // Parse outgoing channel set.
93
- chanStrings := strings .Split (ctx .String ("channel" ), "," )
92
+ // Parse outgoing channel set. Don't string split if the flag is empty.
93
+ // Otherwise strings.Split returns a slice of length one with an empty
94
+ // element.
94
95
var outgoingChanSet []uint64
95
- for _ , chanString := range chanStrings {
96
- chanID , err := strconv .ParseUint (chanString , 10 , 64 )
97
- if err != nil {
98
- return err
96
+ if ctx .IsSet ("channel" ) {
97
+ chanStrings := strings .Split (ctx .String ("channel" ), "," )
98
+ for _ , chanString := range chanStrings {
99
+ chanID , err := strconv .ParseUint (chanString , 10 , 64 )
100
+ if err != nil {
101
+ return fmt .Errorf ("error parsing channel id " +
102
+ "\" %v\" " , chanString )
103
+ }
104
+ outgoingChanSet = append (outgoingChanSet , chanID )
99
105
}
100
- outgoingChanSet = append (outgoingChanSet , chanID )
101
106
}
102
107
103
108
var destAddr string
You can’t perform that action at this time.
0 commit comments