diff --git a/ui/BankingiOSApp/BankingiOSApp/persistence/CoreDataBankingPersistence.swift b/ui/BankingiOSApp/BankingiOSApp/persistence/CoreDataBankingPersistence.swift index 6155759c..16f71a9f 100644 --- a/ui/BankingiOSApp/BankingiOSApp/persistence/CoreDataBankingPersistence.swift +++ b/ui/BankingiOSApp/BankingiOSApp/persistence/CoreDataBankingPersistence.swift @@ -16,8 +16,9 @@ class CoreDataBankingPersistence: IBankingPersistence, ITransactionPartySearcher return persistentContainer!.viewContext }() + func saveContext () { - if context.hasChanges { + if persistentContainer != nil && context.hasChanges { do { try context.save() } catch {