From 14def87d5af71d54da022465d21aa53ea56562ec Mon Sep 17 00:00:00 2001 From: hoo47 Date: Tue, 14 Jan 2025 02:04:23 +0900 Subject: [PATCH] refactor: apply comments --- broker.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/broker.go b/broker.go index 4c88c9956..5f99d2421 100644 --- a/broker.go +++ b/broker.go @@ -1570,7 +1570,11 @@ func (b *Broker) createSaslAuthenticateRequest(msg []byte) *SaslAuthenticateRequ func buildClientFirstMessage(token *AccessToken) ([]byte, error) { var ext string - if token != nil && token.Extensions != nil && len(token.Extensions) > 0 { + if token == nil { + return []byte{}, fmt.Errorf("failed to build client first message: token is nil") + } + + if len(token.Extensions) > 0 { if _, ok := token.Extensions[SASLExtKeyAuth]; ok { return []byte{}, fmt.Errorf("the extension `%s` is invalid", SASLExtKeyAuth) }