From f50a250cd9fac47bcbd9a05e99c8ffe4d294e320 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Mon, 21 Feb 2022 14:15:09 +0100 Subject: Optimize Guid comparisons * Use Guid.Equals(Guid) instead of the == override * Ban the usage of Guid.Equals(Object) to prevent accidental boxing * Compare to default(Guid) instead of Guid.Empty --- Emby.Server.Implementations/HttpServer/Security/SessionContext.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Emby.Server.Implementations/HttpServer/Security') diff --git a/Emby.Server.Implementations/HttpServer/Security/SessionContext.cs b/Emby.Server.Implementations/HttpServer/Security/SessionContext.cs index bb6041f28..15ab363fe 100644 --- a/Emby.Server.Implementations/HttpServer/Security/SessionContext.cs +++ b/Emby.Server.Implementations/HttpServer/Security/SessionContext.cs @@ -47,7 +47,9 @@ namespace Emby.Server.Implementations.HttpServer.Security { var session = await GetSession(requestContext).ConfigureAwait(false); - return session.UserId.Equals(Guid.Empty) ? null : _userManager.GetUserById(session.UserId); + return session.UserId.Equals(default) + ? null + : _userManager.GetUserById(session.UserId); } public Task GetUser(object requestContext) -- cgit v1.2.3