don't open media if context not mounted

This commit is contained in:
Henry Hiles 2026-10-22 16:09:27 -04:00
commit 3e1552f246
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
2 changed files with 2 additions and 0 deletions

View file

@ -28,6 +28,7 @@ class const AudioPlayer(
final audio = await ref
.read(ClientController.provider.notifier)
.downloadMedia(.new(mxc: uri, encrypted: encrypted));
if (!context.mounted) return;
await player.open(Media(audio.path), play: false);
if (context.mounted) loaded.value = true;
});

View file

@ -30,6 +30,7 @@ class const VideoPlayer(
final video = await ref
.read(ClientController.provider.notifier)
.downloadMedia(.new(mxc: uri, encrypted: encrypted));
if (!context.mounted) return;
await player.open(Media(video.path), play: false);
if (context.mounted) loaded.value = true;
});