mirror of https://github.com/jetkvm/kvm.git
fix: move nil check before accessing session.ID to satisfy staticcheck
This commit is contained in:
parent
c8b456bf6a
commit
ce1cbe1944
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue