Skip to content

Commit

Permalink
Fix crash when PAGComposition is null. (#531)
Browse files Browse the repository at this point in the history
Co-authored-by: kevingpqi <kevingpqi@tencent.com>
  • Loading branch information
kevingpqi123 and kevingpqi123 authored Sep 15, 2022
1 parent cb71396 commit b3bd004
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion android/libpag/src/main/java/org/libpag/PAGView.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
// Align with iOS platform, avoid triggering this method when stopping
int repeatCount = ((ValueAnimator) animation).getRepeatCount();
if (repeatCount >= 0 && (currentPlayTime / animation.getDuration() > repeatCount)) {
if (repeatCount >= 0 && (animation.getDuration() > 0) &&
(currentPlayTime / animation.getDuration() > repeatCount)) {
ArrayList<PAGViewListener> arrayList;
synchronized (PAGView.this) {
arrayList = new ArrayList<>(mViewListeners);
Expand Down Expand Up @@ -514,6 +515,9 @@ private boolean isMainThread() {
}

private void startAnimator() {
if (animator.getDuration() <= 0) {
return;
}
if (isMainThread()) {
animator.start();
} else {
Expand Down

0 comments on commit b3bd004

Please sign in to comment.