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 --- Jellyfin.Api/Controllers/SessionController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Jellyfin.Api/Controllers/SessionController.cs') diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs index a6bbd40cc..860bccb9b 100644 --- a/Jellyfin.Api/Controllers/SessionController.cs +++ b/Jellyfin.Api/Controllers/SessionController.cs @@ -74,7 +74,7 @@ namespace Jellyfin.Api.Controllers result = result.Where(i => string.Equals(i.DeviceId, deviceId, StringComparison.OrdinalIgnoreCase)); } - if (controllableByUserId.HasValue && !controllableByUserId.Equals(Guid.Empty)) + if (controllableByUserId.HasValue && !controllableByUserId.Equals(default)) { result = result.Where(i => i.SupportsRemoteControl); @@ -82,12 +82,12 @@ namespace Jellyfin.Api.Controllers if (!user.HasPermission(PermissionKind.EnableRemoteControlOfOtherUsers)) { - result = result.Where(i => i.UserId.Equals(Guid.Empty) || i.ContainsUser(controllableByUserId.Value)); + result = result.Where(i => i.UserId.Equals(default) || i.ContainsUser(controllableByUserId.Value)); } if (!user.HasPermission(PermissionKind.EnableSharedDeviceControl)) { - result = result.Where(i => !i.UserId.Equals(Guid.Empty)); + result = result.Where(i => !i.UserId.Equals(default)); } if (activeWithinSeconds.HasValue && activeWithinSeconds.Value > 0) -- cgit v1.2.3