Merge pull request #111235 from Abirdcfly/220719

fix a possible panic because of taking the address of nil

Kubernetes-commit: e234917e0a3e4bb384ef14c198742643a7e170fd
This commit is contained in:
Kubernetes Publisher 2022-07-19 00:12:06 -07:00
commit 267b6570f5

View File

@ -51,10 +51,10 @@ func (a *PromptingAuthLoader) LoadAuth(path string) (*clientauth.Info, error) {
// Prompt for user/pass and write a file if none exists.
if _, err := os.Stat(path); os.IsNotExist(err) {
authPtr, err := a.Prompt()
auth := *authPtr
if err != nil {
return nil, err
}
auth := *authPtr
data, err := json.Marshal(auth)
if err != nil {
return &auth, err