fix(detail): guard on-deck fallback against a disposed screen

_ensureFallbackOnDeckEpisode is reached through unawaited fetch
continuations and reads providers through State.context — leaving the
screen before the season fetch settled crashed on the null-check in
the context getter.
This commit is contained in:
edde746
2026-07-05 14:16:04 +02:00
parent be072365fc
commit d9130cd932
+3
View File
@@ -2983,6 +2983,9 @@ class _MediaDetailScreenState extends State<MediaDetailScreen>
/// resumes it. No-op once a backend on-deck episode exists, or when every
/// loaded episode is watched (keep the default S1E1 for a rewatch).
void _ensureFallbackOnDeckEpisode() {
// Reached via unawaited fetch continuations — the screen may be gone by
// now, and _freshAll reads providers through State.context.
if (!mounted) return;
if (_onDeckEpisode != null) return;
final next = firstUnwatchedEpisode(_freshAll(_episodes));
if (next == null) return;