add boundary check before access os.Args

This commit is contained in:
Chao Xu
2015-07-09 16:15:42 -07:00
parent 3094c1624b
commit 48679d21d2
6 changed files with 6 additions and 6 deletions

View File

@@ -105,7 +105,7 @@ func validateArguments(cmd *cobra.Command, args []string) (deploymentKey, filena
}
func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) error {
if os.Args[1] == "rollingupdate" {
if len(os.Args) > 1 && os.Args[1] == "rollingupdate" {
printDeprecationWarning("rolling-update", "rollingupdate")
}
deploymentKey, filename, image, oldName, err := validateArguments(cmd, args)