Skip to content

Commit

Permalink
GetDefaultAuthConfig: fix potential panic due to unhandled error
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Oct 29, 2020
1 parent a0cacb0 commit f32731f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cli/command/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,18 @@ func GetDefaultAuthConfig(cli Cli, checkCredStore bool, serverAddress string, is
if !isDefaultRegistry {
serverAddress = registry.ConvertToHostname(serverAddress)
}
var authconfig configtypes.AuthConfig
var authconfig = configtypes.AuthConfig{}
var err error
if checkCredStore {
authconfig, err = cli.ConfigFile().GetAuthConfig(serverAddress)
} else {
authconfig = configtypes.AuthConfig{}
if err != nil {
return nil, err
}
}
authconfig.ServerAddress = serverAddress
authconfig.IdentityToken = ""
res := types.AuthConfig(authconfig)
return &res, err
return &res, nil
}

// ConfigureAuth handles prompting of user's username and password if needed
Expand Down

0 comments on commit f32731f

Please sign in to comment.