check if changes before save context

This commit is contained in:
Bob Sun 2017-02-15 21:48:06 +08:00
parent ff83ed29d4
commit 0be04eac30
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -197,7 +197,9 @@ class PasswordStore {
passwordEntity.synced = true passwordEntity.synced = true
} }
do { do {
try context.save() if context.hasChanges {
try context.save()
}
} catch { } catch {
fatalError("Failed to save: \(error)") fatalError("Failed to save: \(error)")
} }