Compare commits

...

1 Commits

Author SHA1 Message Date
mertalev
75c0f58759 check if disposed 2025-09-11 18:15:19 -04:00

View File

@@ -88,10 +88,18 @@ class NativeVideoViewer extends HookConsumerWidget {
} }
final videoAsset = await ref.read(assetServiceProvider).getAsset(asset) ?? asset; final videoAsset = await ref.read(assetServiceProvider).getAsset(asset) ?? asset;
if (!context.mounted) {
return null;
}
try { try {
if (videoAsset.hasLocal && videoAsset.livePhotoVideoId == null) { if (videoAsset.hasLocal && videoAsset.livePhotoVideoId == null) {
final id = videoAsset is LocalAsset ? videoAsset.id : (videoAsset as RemoteAsset).localId!; final id = videoAsset is LocalAsset ? videoAsset.id : (videoAsset as RemoteAsset).localId!;
final file = await const StorageRepository().getFileForAsset(id); final file = await const StorageRepository().getFileForAsset(id);
if (!context.mounted) {
return null;
}
if (file == null) { if (file == null) {
throw Exception('No file found for the video'); throw Exception('No file found for the video');
} }
@@ -289,7 +297,7 @@ class NativeVideoViewer extends HookConsumerWidget {
ref.read(videoPlaybackValueProvider.notifier).reset(); ref.read(videoPlaybackValueProvider.notifier).reset();
final source = await videoSource; final source = await videoSource;
if (source == null) { if (source == null || !context.mounted) {
return; return;
} }