Skip to content

Commit

Permalink
🚸 Check args length before comparing
Browse files Browse the repository at this point in the history
  • Loading branch information
hybloid authored and tiulpin committed Sep 16, 2024
1 parent d3275c0 commit 96b36d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func isHelpOrVersion(args []string) bool {
}

func isCompletionRequested(args []string) bool {
return args[1] == "completion"
return len(args) >= 2 && args[1] == "completion"
}

// isCommandRequested checks if any command is requested.
Expand Down

0 comments on commit 96b36d6

Please sign in to comment.