fix: fix rare assertion error

This commit is contained in:
Oliver Booth 2024-02-27 19:00:10 +00:00
parent 71b1ff32c4
commit fa87d808dc
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5
1 changed files with 4 additions and 6 deletions

View File

@ -1,4 +1,3 @@
@using System.Diagnostics
@using OliverBooth.Data.Blog @using OliverBooth.Data.Blog
@using OliverBooth.Data.Web @using OliverBooth.Data.Web
@using OliverBooth.Services @using OliverBooth.Services
@ -17,7 +16,6 @@
{ {
UserService.TryGetUser(session.UserId, out user); UserService.TryGetUser(session.UserId, out user);
} }
Debug.Assert(user is not null);
} }
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" data-bs-theme="dark"> <html lang="en" data-bs-theme="dark">
@ -98,7 +96,7 @@
<i class="fa-solid fa-newspaper fa-fw"></i> Blog Posts <i class="fa-solid fa-newspaper fa-fw"></i> Blog Posts
</a> </a>
</li> </li>
@if (user.HasPermission("projects:read")) @if (user?.HasPermission("projects:read") != true)
{ {
<li> <li>
<a asp-page="Projects" class="nav-link @(currentPage == "/Admin/Projects" ? "active" : "text-white")" aria-current="page"> <a asp-page="Projects" class="nav-link @(currentPage == "/Admin/Projects" ? "active" : "text-white")" aria-current="page">
@ -106,7 +104,7 @@
</a> </a>
</li> </li>
} }
@if (user.HasPermission("users:read")) @if (user?.HasPermission("users:read") != true)
{ {
<li> <li>
<a asp-page="Users" class="nav-link @(currentPage == "/Admin/Users" ? "active" : "text-white")" aria-current="page"> <a asp-page="Users" class="nav-link @(currentPage == "/Admin/Users" ? "active" : "text-white")" aria-current="page">
@ -118,8 +116,8 @@
<hr> <hr>
<div class="dropdown"> <div class="dropdown">
<a href="#" class="d-flex align-items-center text-white text-decoration-none dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> <a href="#" class="d-flex align-items-center text-white text-decoration-none dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<img src="@user.AvatarUrl" alt="" width="32" height="32" class="rounded-circle me-2"> <img src="@user?.AvatarUrl" alt="" width="32" height="32" class="rounded-circle me-2">
<strong>@user.DisplayName</strong> <strong>@user?.DisplayName</strong>
</a> </a>
<ul class="dropdown-menu dropdown-menu-dark text-small shadow"> <ul class="dropdown-menu dropdown-menu-dark text-small shadow">
<li><a class="dropdown-item" href="#">New project...</a></li> <li><a class="dropdown-item" href="#">New project...</a></li>