mirror of
https://github.com/fiatjaf/nak.git
synced 2025-09-01 06:20:46 -04:00
fix panic (#12)
* c.Args().Len() - 1 might be negative value * fix getStdinLinesOrFirstArgument * fix getStdinLinesOrFirstArgument
This commit is contained in:
@@ -47,12 +47,11 @@ func getStdinLinesOrBlank() chan string {
|
||||
}
|
||||
}
|
||||
|
||||
func getStdinLinesOrFirstArgument(c *cli.Context) chan string {
|
||||
func getStdinLinesOrFirstArgument(arg string) chan string {
|
||||
// try the first argument
|
||||
target := c.Args().First()
|
||||
if target != "" {
|
||||
if arg != "" {
|
||||
single := make(chan string, 1)
|
||||
single <- target
|
||||
single <- arg
|
||||
close(single)
|
||||
return single
|
||||
}
|
||||
|
Reference in New Issue
Block a user