fix(database): handle cross-drive desktop DB migration

close #1022
This commit is contained in:
edde746
2026-05-12 10:41:32 +02:00
parent 606627cd0c
commit bae127e459
3 changed files with 166 additions and 6 deletions
+15 -1
View File
@@ -1083,7 +1083,21 @@ class _SetupScreenState extends State<SetupScreen> with MountedSetStateMixin {
// through `context` after async gaps trip the use_build_context_synchronously
// lint, and reading early is safe because the registry is a singleton.
final connectionRegistry = context.read<ConnectionRegistry>();
final allConnections = await connectionRegistry.list();
final List<Connection> allConnections;
try {
allConnections = await connectionRegistry.list();
} catch (e, st) {
// Defence-in-depth: a DB-open failure here used to propagate
// uncaught and strand the splash forever (#1022). Route to auth so
// the user is never trapped, and surface to Sentry so an unknown
// regression doesn't go silent.
appLogger.e('Setup: failed to load connections; returning to auth', error: e, stackTrace: st);
unawaited(Sentry.captureException(e, stackTrace: st));
if (mounted) {
unawaited(Navigator.pushReplacement(context, fadeRoute(const AuthScreen())));
}
return;
}
if (allConnections.isEmpty) {
if (mounted) {