Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG FIX: adding count check for navigation stack before getting last item, adding check for mainpage as current page as additional failover. #2379

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,13 @@ static bool TryGetCurrentPage([NotNullWhen(true)] out Page? currentPage)
}

// If not using Shell or a Modal Page, return the visible page in the (non-modal) NavigationStack
if (window.Navigation.NavigationStack[^1] is Page page)
if (window.Navigation.NavigationStack.Count > 0 && window.Navigation.NavigationStack[^1] is Page page)
{
currentPage = page;
return true;
}


return false;

static bool TryGetModalPage(Window window, [NotNullWhen(true)] out Page? page)
Expand Down