From caf29483435c5c4d92391c0f9a27b760bf13a04e Mon Sep 17 00:00:00 2001 From: holoncom Date: Wed, 3 Nov 2021 08:00:17 +0100 Subject: [PATCH] fix null pointer exception when called from scheduled tasks --- DNN Platform/DotNetNuke.Web.Client/ClientResourceSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DNN Platform/DotNetNuke.Web.Client/ClientResourceSettings.cs b/DNN Platform/DotNetNuke.Web.Client/ClientResourceSettings.cs index b7dd2f04529..ac542d28335 100644 --- a/DNN Platform/DotNetNuke.Web.Client/ClientResourceSettings.cs +++ b/DNN Platform/DotNetNuke.Web.Client/ClientResourceSettings.cs @@ -223,7 +223,7 @@ private static string GetPortalSettingThroughReflection(string settingKey) try { var method = _portalAliasControllerType.GetMethod("GetPortalAliasInfo"); - var portalAliasInfo = method.Invoke(null, new object[] { HttpContext.Current.Request.Url.Host }); + var portalAliasInfo = HttpContext.Current != null ? method.Invoke(null, new object[] { HttpContext.Current.Request.Url.Host }) : null; if (portalAliasInfo != null) { object portalId = portalAliasInfo.GetType().GetProperty("PortalID").GetValue(portalAliasInfo, new object[] { });