feat: fix DeleteSession to handle missing sessions gracefully (#4979)

This commit is contained in:
Yang Luo
2026-02-05 15:41:15 +08:00
parent b771add9e3
commit 442f8fb19e

View File

@@ -175,8 +175,10 @@ func DeleteSession(id, curSessionId string) (bool, error) {
return false, err
}
// If session doesn't exist, return success with no rows affected
// This is a valid state (e.g., when a user has no active session)
if session == nil {
return false, fmt.Errorf("session is nil")
return false, nil
}
if slices.Contains(session.SessionId, curSessionId) {