Răsfoiți Sursa

Merge pull request #1452 from onevcat/fix/single-image-animated-view

Early return when no animator found
Wei Wang 5 ani în urmă
părinte
comite
1c907b7eb1
1 a modificat fișierele cu 2 adăugiri și 3 ștergeri
  1. 2 3
      Sources/Views/AnimatedImageView.swift

+ 2 - 3
Sources/Views/AnimatedImageView.swift

@@ -205,9 +205,8 @@ open class AnimatedImageView: UIImageView {
     /// Starts the animation.
     /// Starts the animation.
     override open func startAnimating() {
     override open func startAnimating() {
         guard !isAnimating else { return }
         guard !isAnimating else { return }
-        if animator?.isReachMaxRepeatCount ?? false {
-            return
-        }
+        guard let animator = animator else { return }
+        guard !animator.isReachMaxRepeatCount else { return }
 
 
         displayLink.isPaused = false
         displayLink.isPaused = false
     }
     }