mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-30 18:22:37 -04:00 
			
		
		
		
	fix(mobile): video player using ref after disposal (#21843)
check if disposed
This commit is contained in:
		
							parent
							
								
									55ad83d80d
								
							
						
					
					
						commit
						43b06a036d
					
				| @ -88,10 +88,18 @@ class NativeVideoViewer extends HookConsumerWidget { | ||||
|       } | ||||
| 
 | ||||
|       final videoAsset = await ref.read(assetServiceProvider).getAsset(asset) ?? asset; | ||||
|       if (!context.mounted) { | ||||
|         return null; | ||||
|       } | ||||
| 
 | ||||
|       try { | ||||
|         if (videoAsset.hasLocal && videoAsset.livePhotoVideoId == null) { | ||||
|           final id = videoAsset is LocalAsset ? videoAsset.id : (videoAsset as RemoteAsset).localId!; | ||||
|           final file = await const StorageRepository().getFileForAsset(id); | ||||
|           if (!context.mounted) { | ||||
|             return null; | ||||
|           } | ||||
| 
 | ||||
|           if (file == null) { | ||||
|             throw Exception('No file found for the video'); | ||||
|           } | ||||
| @ -289,7 +297,7 @@ class NativeVideoViewer extends HookConsumerWidget { | ||||
|       ref.read(videoPlaybackValueProvider.notifier).reset(); | ||||
| 
 | ||||
|       final source = await videoSource; | ||||
|       if (source == null) { | ||||
|       if (source == null || !context.mounted) { | ||||
|         return; | ||||
|       } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user