fix: move nil check before accessing session.ID to satisfy staticcheck

This commit is contained in:
Alex P 2025-10-10 00:05:08 +03:00
parent c8b456bf6a
commit ce1cbe1944
1 changed files with 4 additions and 4 deletions

View File

@ -126,15 +126,15 @@ func NewSessionManager(logger *zerolog.Logger) *SessionManager {
} }
func (sm *SessionManager) AddSession(session *Session, clientSettings *SessionSettings) error { func (sm *SessionManager) AddSession(session *Session, clientSettings *SessionSettings) error {
sm.logger.Debug().
Str("sessionID", session.ID).
Msg("AddSession ENTRY")
// Basic input validation // Basic input validation
if session == nil { if session == nil {
sm.logger.Error().Msg("AddSession: session is nil") sm.logger.Error().Msg("AddSession: session is nil")
return errors.New("session cannot be nil") return errors.New("session cannot be nil")
} }
sm.logger.Debug().
Str("sessionID", session.ID).
Msg("AddSession ENTRY")
// Validate nickname if provided (matching frontend validation) // Validate nickname if provided (matching frontend validation)
if session.Nickname != "" { if session.Nickname != "" {
if len(session.Nickname) < 2 { if len(session.Nickname) < 2 {