Skip to content

Commit

Permalink
Add guard in animationMovedToWindow()
Browse files Browse the repository at this point in the history
Don't invoke any state updates when both the `window` and the `superview` is `nil`
  • Loading branch information
zenangst committed Jan 21, 2020
1 parent 738109f commit 86a450f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lottie-swift/src/Public/Animation/AnimationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,11 @@ final public class AnimationView: LottieView {
}

override func animationMovedToWindow() {
/// Don't update any state if both the `superview` and `window` is `nil`
guard window != nil && superview != nil else {
return
}

if window != nil {
updateAnimationForForegroundState()
} else {
Expand Down

0 comments on commit 86a450f

Please sign in to comment.