Skip to content

Commit

Permalink
Add uri in NullPointerException which occurs in DefaultBitmapAnimatio…
Browse files Browse the repository at this point in the history
…nDrawableFactory::createDrawable

Reviewed By: defHLT

Differential Revision: D58772873

fbshipit-source-id: 6055dc44cd8355d19c28313c13717f248d0eb346
  • Loading branch information
Ishay Weinstock authored and facebook-github-bot committed Jun 19, 2024
1 parent cbb2040 commit 1d34bca
Showing 1 changed file with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import com.facebook.fresco.animation.bitmap.wrapper.AnimatedDrawableBackendFrameRenderer;
import com.facebook.fresco.animation.drawable.AnimatedDrawable2;
import com.facebook.fresco.animation.drawable.KAnimatedDrawable2;
import com.facebook.fresco.middleware.HasExtraData;
import com.facebook.fresco.vito.options.ImageOptions;
import com.facebook.fresco.vito.options.ImageOptionsDrawableFactory;
import com.facebook.fresco.vito.options.RoundingOptions;
Expand Down Expand Up @@ -137,11 +138,21 @@ public Drawable createDrawable(
Resources resources, CloseableImage closeableImage, ImageOptions imageOptions) {
CloseableAnimatedImage closeable = ((CloseableAnimatedImage) closeableImage);
AnimatedImage animatedImage = closeable.getImage();
AnimationBackend animationBackend =
createAnimationBackend(
Preconditions.checkNotNull(closeable.getImageResult()),
animatedImage != null ? animatedImage.getAnimatedBitmapConfig() : null,
imageOptions);
AnimationBackend animationBackend = null;
try {
animationBackend =
createAnimationBackend(
Preconditions.checkNotNull(closeable.getImageResult()),
animatedImage != null ? animatedImage.getAnimatedBitmapConfig() : null,
imageOptions);
} catch (NullPointerException e) {
Object uri = closeableImage.getExtra(HasExtraData.KEY_URI_SOURCE);
if (uri != null) {
throw new NullPointerException(e.getMessage() + " uri=" + uri.toString());
} else {
throw e;
}
}
if (useRendererAnimatedDrawable.get()) {
return new KAnimatedDrawable2(animationBackend);
} else {
Expand Down

0 comments on commit 1d34bca

Please sign in to comment.