Fixed that persistentContainer and therefore context is nil if during login screen app enters background

This commit is contained in:
dankito 2020-10-14 00:45:56 +02:00
parent 360e75426f
commit 93de8bf252
1 changed files with 2 additions and 1 deletions

View File

@ -16,8 +16,9 @@ class CoreDataBankingPersistence: IBankingPersistence, ITransactionPartySearcher
return persistentContainer!.viewContext return persistentContainer!.viewContext
}() }()
func saveContext () { func saveContext () {
if context.hasChanges { if persistentContainer != nil && context.hasChanges {
do { do {
try context.save() try context.save()
} catch { } catch {