etcdctl/ctlv3: don't crash when we should prompt for pw.

when 'etcdctl --user name get blah' is invoked to
 prompt for password, don't panic.

 addresses the segfault part of #6343
release-3.0
Jason E. Aten 2016-09-03 10:28:32 -07:00 committed by Gyu-Ho Lee
parent 09a239f040
commit 5c44cdfdaa
1 changed files with 1 additions and 1 deletions

View File

@ -243,7 +243,7 @@ func authCfgFromCmd(cmd *cobra.Command) *authCfg {
var cfg authCfg
splitted := strings.SplitN(userFlag, ":", 2)
if len(splitted) == 0 {
if len(splitted) < 2 {
cfg.username = userFlag
cfg.password, err = speakeasy.Ask("Password: ")
if err != nil {