diff --git a/lib/main.dart b/lib/main.dart index 70d38f79..4f44eaf7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -133,10 +133,14 @@ Future _migrateOldLayout() async { } } // remove subfolder if empty - if (await oldSubDir.list().isEmpty) await oldSubDir.delete(); + if (await oldSubDir.exists() && await oldSubDir.list().isEmpty) { + await oldSubDir.delete(); + } } // Clean up old empty folder - if (await oldRoot.list().isEmpty) await oldRoot.delete(); + if (await oldRoot.exists() && await oldRoot.list().isEmpty) { + await oldRoot.delete(); + } } class MyApp extends ConsumerStatefulWidget {