Skip to content

Commit 95e5f6b

Browse files
committed
authprovider: Fix error return from Credentials when logger is nil
This would segfault if SetLogger had not been called, because progresswriter.Wrap returns nil when its logger arg is nil, causing Credentials to return nil, nil. Signed-off-by: Aaron Lehmann <[email protected]>
1 parent a5bccca commit 95e5f6b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

session/auth/authprovider/authprovider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func (ap *authProvider) Credentials(ctx context.Context, req *auth.CredentialsRe
152152
defer ap.mu.Unlock()
153153
_, ok := ap.loggerCache[req.Host]
154154
ap.loggerCache[req.Host] = struct{}{}
155-
if !ok {
155+
if !ok && ap.logger != nil {
156156
return resp, progresswriter.Wrap(fmt.Sprintf("[auth] sharing credentials for %s", req.Host), ap.logger, func(progresswriter.SubLogger) error {
157157
return err
158158
})

0 commit comments

Comments
 (0)