diff --git a/main.go b/main.go index c22854f..9063acf 100644 --- a/main.go +++ b/main.go @@ -448,7 +448,7 @@ func init() { } func main() { - if os.Args[1] == "-v" || os.Args[1] == "version" { + if len(os.Args) > 1 && (os.Args[1] == "-v" || os.Args[1] == "version") { fmt.Fprintf(os.Stdout, "{...} UpClapi version:%s\n",VERSION) os.Exit(0) } @@ -560,4 +560,4 @@ func ParseFlags() (RunFlags,error) { } // Return the configuration path return runFlags,nil -} \ No newline at end of file +}