fix out of bound exceptions

pull/12966/head
Steven Powell 2021-11-16 11:40:02 -05:00
parent 87d35f7453
commit 2a99b2f946
3 changed files with 7 additions and 5 deletions

View File

@ -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]

View File

@ -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()

View File

@ -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()