Skip to content

Commit

Permalink
Avoid ClassCastExceptions in DefaultBitmapAnimationDrawableFactory
Browse files Browse the repository at this point in the history
Differential Revision: D64261390
  • Loading branch information
Abbondanzo authored and facebook-github-bot committed Oct 11, 2024
1 parent defe02d commit cdd2e61
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ public boolean supportsImageType(CloseableImage image) {
}

@Override
@Nullable
public Drawable createDrawable(CloseableImage image) {
if (!supportsImageType(closeableImage)) {
return null;
}
CloseableAnimatedImage closeable = ((CloseableAnimatedImage) image);
AnimatedImage animatedImage = closeable.getImage();
AnimationBackend animationBackend =
Expand All @@ -134,8 +138,12 @@ public Drawable createDrawable(CloseableImage image) {
}

@Override
@Nullable
public Drawable createDrawable(
Resources resources, CloseableImage closeableImage, ImageOptions imageOptions) {
if (!supportsImageType(closeableImage)) {
return null;
}
CloseableAnimatedImage closeable = ((CloseableAnimatedImage) closeableImage);
AnimatedImage animatedImage = closeable.getImage();
AnimationBackend animationBackend = null;
Expand Down

0 comments on commit cdd2e61

Please sign in to comment.