From 9cca40420c36aa82afdb544248097c41dcc8e1cf Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Sat, 18 Apr 2026 18:08:51 +0200 Subject: [PATCH] fix: guard player back pop with canPop --- lib/screens/video_player_screen.dart | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/screens/video_player_screen.dart b/lib/screens/video_player_screen.dart index 18469137..6a14d458 100644 --- a/lib/screens/video_player_screen.dart +++ b/lib/screens/video_player_screen.dart @@ -1990,8 +1990,11 @@ class VideoPlayerScreenState extends State with WidgetsBindin if (mounted) { await _exitFullscreenIfNeeded(); if (!mounted) return; - _isExiting.value = true; - Navigator.of(context).pop(true); + final navigator = Navigator.of(context); + if (navigator.canPop()) { + _isExiting.value = true; + navigator.pop(true); + } } } return; @@ -2001,8 +2004,11 @@ class VideoPlayerScreenState extends State with WidgetsBindin // Default behavior for hosts or non-session users if (!mounted) return; - _isExiting.value = true; - Navigator.of(context).pop(true); + final navigator = Navigator.of(context); + if (navigator.canPop()) { + _isExiting.value = true; + navigator.pop(true); + } } finally { _isHandlingBack = false; }