Skip to content

Commit 46ee805

Browse files
nixkuroiunknownTheCodeTravelerne0rrmatrix
authored
BUG FIX: adding count check for navigation stack before getting last item, adding check for mainpage as current page as additional failover. (#2379)
* adding count check for navigation stack before getting last-1, and adding check for mainpage as last resort * Removing obsolete code for Application.Current.MainPage * Use `LastOrDefault()` --------- Co-authored-by: unknown <[email protected]> Co-authored-by: Brandon Minnick <[email protected]> Co-authored-by: James Crutchley <[email protected]> Co-authored-by: Brandon Minnick <[email protected]>
1 parent 238f413 commit 46ee805

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.macios.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static bool TryGetCurrentPage([NotNullWhen(true)] out Page? currentPage)
170170
}
171171

172172
// If not using Shell or a Modal Page, return the visible page in the (non-modal) NavigationStack
173-
if (window.Navigation.NavigationStack[^1] is Page page)
173+
if (window.Navigation.NavigationStack.LastOrDefault() is Page page)
174174
{
175175
currentPage = page;
176176
return true;

0 commit comments

Comments
 (0)