From 0be04eac3063084398650e669ddcf3cff1da4d74 Mon Sep 17 00:00:00 2001 From: Bob Sun Date: Wed, 15 Feb 2017 21:48:06 +0800 Subject: [PATCH] check if changes before save context --- pass/Models/PasswordStore.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pass/Models/PasswordStore.swift b/pass/Models/PasswordStore.swift index 3b19c4e..e72ff28 100644 --- a/pass/Models/PasswordStore.swift +++ b/pass/Models/PasswordStore.swift @@ -197,7 +197,9 @@ class PasswordStore { passwordEntity.synced = true } do { - try context.save() + if context.hasChanges { + try context.save() + } } catch { fatalError("Failed to save: \(error)") }