diff --git a/VoiceInk/Services/DictionaryImportExportService.swift b/VoiceInk/Services/DictionaryImportExportService.swift index 20f4415..1920f1b 100644 --- a/VoiceInk/Services/DictionaryImportExportService.swift +++ b/VoiceInk/Services/DictionaryImportExportService.swift @@ -159,6 +159,8 @@ class DictionaryImportExportService { self.showAlert(title: "Import Successful", message: message) } catch { + // Rollback any unsaved changes to maintain consistency + context.rollback() self.showAlert(title: "Import Error", message: "Error importing dictionary data: \(error.localizedDescription). The file might be corrupted or not in the correct format.") } } else {