aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2021-05-06 23:33:41 +0200
committerGitHub <noreply@github.com>2021-05-06 23:33:41 +0200
commita4a3f598af92c7e62a920c4a2eb4f89081c13648 (patch)
tree3c1ac92e2d348aaae53315c6a4caa02fbd7ba0d9 /Jellyfin.Api/Auth/BaseAuthorizationHandler.cs
parentad1d9d9a23c4bff7a485a61fe41639a7d1b3491e (diff)
parent4b9a64c18cff58938dab0c0770147a5e48c833f9 (diff)
Merge pull request #5982 from Bond-009/nullable
Diffstat (limited to 'Jellyfin.Api/Auth/BaseAuthorizationHandler.cs')
-rw-r--r--Jellyfin.Api/Auth/BaseAuthorizationHandler.cs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs b/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs
index 7d68aecf9..392498c53 100644
--- a/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs
+++ b/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs
@@ -77,8 +77,9 @@ namespace Jellyfin.Api.Auth
return false;
}
- var ip = _httpContextAccessor.HttpContext.GetNormalizedRemoteIp();
- var isInLocalNetwork = _networkManager.IsInLocalNetwork(ip);
+ var isInLocalNetwork = _httpContextAccessor.HttpContext != null
+ && _networkManager.IsInLocalNetwork(_httpContextAccessor.HttpContext.GetNormalizedRemoteIp());
+
// User cannot access remotely and user is remote
if (!user.HasPermission(PermissionKind.EnableRemoteAccess) && !isInLocalNetwork)
{