Skip to content

Commit

Permalink
fix(Menu): 增加可为空支持防止异常崩溃
Browse files Browse the repository at this point in the history
  • Loading branch information
ArgoZhang committed Apr 23, 2024
1 parent e30fd9b commit ff73902
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static class MenuExtensions
public static MenuItem Parse(this DataAccess.Models.Navigation menu) => new()
{
Text = menu.Name,
Url = menu.Url.Replace("~/", "/"),
Url = menu.Url?.Replace("~/", "/"),
Icon = menu.Icon,
Match = NavLinkMatch.All,
Target = menu.Target,
Expand Down
2 changes: 1 addition & 1 deletion src/blazor/client/BootstrapClient.Web.Core/AdminService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public Task<bool> AuthorizingNavigation(string userName, string url)
if (Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out var uri))
{
ret = Navigations.GetMenus(userName)
.Any(m => m.Url.Contains(uri.AbsolutePath, StringComparison.OrdinalIgnoreCase));
.Any(m => m.Url?.Contains(uri.AbsolutePath, StringComparison.OrdinalIgnoreCase) ?? false);
}
return Task.FromResult(ret);
}
Expand Down

0 comments on commit ff73902

Please sign in to comment.