Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Avoid PathNotFoundException on disposing native video widget

ashilkn26c6078693e4
diff --git a/mobile/lib/ui/viewer/file/video_widget_native.dart b/mobile/lib/ui/viewer/file/video_widget_native.dart
index 4281d405df..ee912afdbd 100644
--- a/mobile/lib/ui/viewer/file/video_widget_native.dart
+++ b/mobile/lib/ui/viewer/file/video_widget_native.dart
@@ -123,11 +123,17 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
//https://github.com/fluttercandies/flutter_photo_manager/blob/8afba2745ebaac6af8af75de9cbded9157bc2690/README.md#clear-caches
if (_shouldClearCache) {
_logger.info("Clearing cache");
- File(_filePath!).delete().then(
- (value) {
- _logger.info("Cache cleared");
- },
- );
+ final file = File(_filePath!);
+
+ /// Checking if exists to avoid observed PathNotFoundException. Didn't find
+ /// root cause.
+ if (file.existsSync()) {
+ file.delete().then(
+ (value) {
+ _logger.info("Cache cleared");
+ },
+ );
+ }
}
_guestViewEventSubscription.cancel();
pauseVideoSubscription.cancel();