diff --git a/Shogi.UI/Pages/Home/Account/AccountManager.cs b/Shogi.UI/Pages/Home/Account/AccountManager.cs
index ea24f26..25ccfcb 100644
--- a/Shogi.UI/Pages/Home/Account/AccountManager.cs
+++ b/Shogi.UI/Pages/Home/Account/AccountManager.cs
@@ -54,7 +54,7 @@ public class AccountManager
{
var state = await authState.GetAuthenticationStateAsync();
- if (state.User?.Identity?.Name == null || state.User?.Identity?.IsAuthenticated == false)
+ if (state?.User?.Identity?.Name == null || state.User?.Identity?.IsAuthenticated == false)
{
// Set the login platform so that we know to log in with microsoft after being redirected away from the UI.
await localStorage.SetAccountPlatform(WhichAccountPlatform.Microsoft);
@@ -66,7 +66,7 @@ public class AccountManager
///
/// Try to log in with the account used from the previous browser session.
///
- ///
+ /// True if login succeeded.
public async Task TryLoginSilentAsync()
{
var platform = await localStorage.GetAccountPlatform();
diff --git a/Shogi.UI/Pages/Home/LoginModal.razor b/Shogi.UI/Pages/Home/LoginModal.razor
index d1367d5..9a419a9 100644
--- a/Shogi.UI/Pages/Home/LoginModal.razor
+++ b/Shogi.UI/Pages/Home/LoginModal.razor
@@ -1,4 +1,5 @@
@inject AccountManager Account
+@inject AccountState AccountState
@@ -26,13 +27,17 @@
}
else
{
-
Welcome to Shogi!
How would you like to proceed?
+ @if (AccountState.User != null)
+ {
+ /* This is an escape hatch in case user login fails in certain ways. */
+
+ }