From 973f8a41b9ae020cfd511cf8a449a6b747585d47 Mon Sep 17 00:00:00 2001 From: SuhorukovAnton Date: Wed, 29 Dec 2021 18:47:35 +0300 Subject: [PATCH] analizators/s2259 --- common/ASC.Core.Common/BaseCommonLinkUtility.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/ASC.Core.Common/BaseCommonLinkUtility.cs b/common/ASC.Core.Common/BaseCommonLinkUtility.cs index 75c153b4149..f2a63c9f0c5 100644 --- a/common/ASC.Core.Common/BaseCommonLinkUtility.cs +++ b/common/ASC.Core.Common/BaseCommonLinkUtility.cs @@ -90,6 +90,9 @@ public BaseCommonLinkUtility( if (HttpContextAccessor?.HttpContext?.Request != null) { var u = HttpContextAccessor?.HttpContext.Request.GetUrlRewriter(); + + if (u == null) throw new ArgumentNullException("u"); + uriBuilder = new UriBuilder(u.Scheme, LOCALHOST, u.Port); } _serverRoot = uriBuilder; @@ -125,6 +128,9 @@ public string ServerRootPath if (HttpContextAccessor?.HttpContext?.Request != null) { var u = HttpContextAccessor?.HttpContext?.Request.GetUrlRewriter(); + + if (u == null) throw new ArgumentNullException("u"); + result = new UriBuilder(u.Scheme, u.Host, u.Port); if (CoreBaseSettings.Standalone && !result.Uri.IsLoopback)