mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
fix: Profile coordinator null safety and data loss
This commit is contained in:
@@ -212,7 +212,8 @@ class ProfileWorkspaceCoordinator {
|
||||
if (profileId == ConfigProfile.defaultProfileId) {
|
||||
return snapshotCurrentProfile(id: profileId, name: 'Default');
|
||||
}
|
||||
return profileManager.getProfile(profileId)!;
|
||||
return profileManager.getProfile(profileId) ??
|
||||
await snapshotCurrentProfile(id: profileId, name: 'Unknown');
|
||||
}
|
||||
|
||||
Future<void> exportProfile(ConfigProfile profile) async {
|
||||
@@ -300,7 +301,10 @@ class ProfileWorkspaceCoordinator {
|
||||
return;
|
||||
}
|
||||
final current = profileManager.getProfile(profileManager.activeProfileId);
|
||||
if (current == null) return;
|
||||
if (current == null) {
|
||||
await _persistCurrentState();
|
||||
return;
|
||||
}
|
||||
final snapshot = await snapshotCurrentProfile(
|
||||
id: current.id,
|
||||
name: current.name,
|
||||
|
||||
Reference in New Issue
Block a user