diff --git a/Sources/DataStack+Migration.swift b/Sources/DataStack+Migration.swift index e1a8be4..c6640dc 100644 --- a/Sources/DataStack+Migration.swift +++ b/Sources/DataStack+Migration.swift @@ -708,9 +708,9 @@ public extension DataStack { var fakeProgress: Float = 0 var recursiveCheck: () -> Void = {} - recursiveCheck = { + recursiveCheck = { [weak timerQueue] in - guard fakeProgress < 1 else { + guard let timerQueue = timerQueue, fakeProgress < 1 else { return } diff --git a/Sources/MigrationManager.swift b/Sources/MigrationManager.swift index eda35c8..042f66b 100644 --- a/Sources/MigrationManager.swift +++ b/Sources/MigrationManager.swift @@ -42,7 +42,10 @@ internal final class MigrationManager: NSMigrationManager, ProgressReporting { return } let progress = self.progress - progress.completedUnitCount = Int64(Float(progress.totalUnitCount) * self.migrationProgress) + progress.completedUnitCount = max( + progress.completedUnitCount, + Int64(Float(progress.totalUnitCount) * self.migrationProgress) + ) }