Skip to content

Commit

Permalink
Avoid ClassCastExceptions in DefaultBitmapAnimationDrawableFactory
Browse files Browse the repository at this point in the history
Reviewed By: oprisnik

Differential Revision: D64261390

fbshipit-source-id: 89dc9ede0eaebe8425da2d5951b465bfc8cfed66
  • Loading branch information
Abbondanzo authored and facebook-github-bot committed Oct 17, 2024
1 parent 9b907f1 commit 1ac653f
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(image)) {
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 1ac653f

Please sign in to comment.