mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-19 17:51:45 +08:00
Prevents throwing exception when Href is null (#8461)
This commit is contained in:
@@ -124,7 +124,7 @@ namespace Orchard.UI.Navigation {
|
||||
string appPath = currentRequest.ApplicationPath ?? "/";
|
||||
string requestUrl = currentRequest.Path.StartsWith(appPath) ? currentRequest.Path.Substring(appPath.Length) : currentRequest.Path;
|
||||
|
||||
string modelUrl = menuItem.Href.Replace("~/", appPath);
|
||||
string modelUrl = menuItem.Href?.Replace("~/", appPath) ?? "";
|
||||
modelUrl = modelUrl.StartsWith(appPath) ? modelUrl.Substring(appPath.Length) : modelUrl;
|
||||
|
||||
if (requestUrl.Equals(modelUrl, StringComparison.OrdinalIgnoreCase) || (!string.IsNullOrEmpty(modelUrl) && requestUrl.StartsWith(modelUrl + "/", StringComparison.OrdinalIgnoreCase))) {
|
||||
|
||||
Reference in New Issue
Block a user