We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
internalSave(_:)
1 parent b01374f commit be515deCopy full SHA for be515de
WordPress/Classes/Utility/ContextManager+ErrorHandling.swift
@@ -67,19 +67,21 @@ extension LegacyContextFactory {
67
extension ManagedObjectContextFactory {
68
69
func internalSave(_ context: NSManagedObjectContext) {
70
+ guard context.hasChanges else {
71
+ return
72
+ }
73
+
74
let inserted = Array(context.insertedObjects)
75
do {
76
try context.obtainPermanentIDs(for: inserted)
77
} catch {
78
DDLogError("Error obtaining permanent object IDs for \(inserted), \(error)")
79
}
80
- if context.hasChanges {
- do {
- try context.save()
- } catch {
81
- handleSaveError(error as NSError, in: context)
82
- }
+ do {
+ try context.save()
83
+ } catch {
84
+ handleSaveError(error as NSError, in: context)
85
86
87
0 commit comments