Sfoglia il codice sorgente

Save guard against deletion errors

Vishnu Mohandas 4 anni fa
parent
commit
ab2f13b8a6
1 ha cambiato i file con 6 aggiunte e 2 eliminazioni
  1. 6 2
      lib/utils/delete_file_util.dart

+ 6 - 2
lib/utils/delete_file_util.dart

@@ -96,8 +96,12 @@ Future<void> deleteFilesOnDeviceOnly(
       localIDs.add(file.localID);
     }
   }
-  final deletedIDs =
-      (await PhotoManager.editor.deleteWithIds(localIDs)).toSet();
+  var deletedIDs;
+  try {
+    deletedIDs = (await PhotoManager.editor.deleteWithIds(localIDs)).toSet();
+  } catch (e, s) {
+    _logger.severe("Could not delete file", e, s);
+  }
   final List<File> deletedFiles = [];
   for (final file in files) {
     // Remove only those files that have been removed from disk