fix out of bound exceptions
parent
87d35f7453
commit
2a99b2f946
|
|
@ -107,7 +107,9 @@ func Execute() {
|
|||
profile := ""
|
||||
for i, a := range os.Args {
|
||||
if a == "--context" {
|
||||
profile = fmt.Sprintf("--profile=%s", os.Args[i+1])
|
||||
if len(os.Args) > i+1 {
|
||||
profile = fmt.Sprintf("--profile=%s", os.Args[i+1])
|
||||
}
|
||||
break
|
||||
} else if strings.HasPrefix(a, "--context=") {
|
||||
context := strings.Split(a, "=")[1]
|
||||
|
|
|
|||
|
|
@ -54,10 +54,10 @@ func main() {
|
|||
|
||||
func execute() error {
|
||||
// sessionID is generated and used at cpu usage benchmark
|
||||
sessionID := os.Args[1]
|
||||
if len(sessionID) == 0 {
|
||||
if len(os.Args) <= 1 || len(os.Args[1]) == 0 {
|
||||
return errors.New("Please identify sessionID")
|
||||
}
|
||||
sessionID := os.Args[1]
|
||||
|
||||
// Create plot instance
|
||||
p := plot.New()
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ func main() {
|
|||
|
||||
func execute() error {
|
||||
// sessionID is generated and used at cpu usage benchmark
|
||||
sessionID := os.Args[1]
|
||||
if len(sessionID) == 0 {
|
||||
if len(os.Args) <= 1 || len(os.Args[1]) == 0 {
|
||||
return errors.New("Please identify sessionID")
|
||||
}
|
||||
sessionID := os.Args[1]
|
||||
|
||||
// Create plot instance
|
||||
p := plot.New()
|
||||
|
|
|
|||
Loading…
Reference in New Issue