Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ 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.LastOrDefault() is Page page)
{
currentPage = page;
return true;
Expand Down