Skip to content

Commit b3cd95a

Browse files
committed
Fix _StateMachine's handleProgress() which stores progressValue when state is not '.Running'.
1 parent 06fce03 commit b3cd95a

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

SwiftTask/_StateMachine.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@ internal class _StateMachine<Progress, Value, Error>
3838

3939
internal func handleProgress(progress: Progress)
4040
{
41-
let oldProgress = self.progress
42-
43-
// NOTE: if `weakified = false`, don't store progressValue for less memory footprint
44-
if !self.weakified {
45-
self.progress = progress
46-
}
47-
4841
if self.state == .Running {
42+
43+
let oldProgress = self.progress
44+
45+
// NOTE: if `weakified = false`, don't store progressValue for less memory footprint
46+
if !self.weakified {
47+
self.progress = progress
48+
}
49+
4950
for handler in self.progressTupleHandlers {
5051
handler(oldProgress: oldProgress, newProgress: progress)
5152
}

0 commit comments

Comments
 (0)