Merge pull request #111273 from Abirdcfly/automated-cherry-pick-of-#111235-upstream-release-1.23

Automated cherry pick of #111235: fix a possible panic because of taking the address of nil
This commit is contained in:
Kubernetes Prow Robot 2022-08-11 06:34:57 -07:00 committed by GitHub
commit e9dbbc3f74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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