From e2d121af43c0021e154ef1b55779fd9bc3246c08 Mon Sep 17 00:00:00 2001 From: TechQI Date: Tue, 9 Aug 2022 09:42:03 +0800 Subject: [PATCH] Fix ImageAssetManager.bitmapForId NPE crash, add id in Logger output --- .../com/airbnb/lottie/manager/ImageAssetManager.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lottie/src/main/java/com/airbnb/lottie/manager/ImageAssetManager.java b/lottie/src/main/java/com/airbnb/lottie/manager/ImageAssetManager.java index 33268ac731..848afede76 100644 --- a/lottie/src/main/java/com/airbnb/lottie/manager/ImageAssetManager.java +++ b/lottie/src/main/java/com/airbnb/lottie/manager/ImageAssetManager.java @@ -1,17 +1,20 @@ package com.airbnb.lottie.manager; + import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.Drawable; -import androidx.annotation.Nullable; import android.text.TextUtils; import android.util.Base64; import android.view.View; +import androidx.annotation.Nullable; + import com.airbnb.lottie.ImageAssetDelegate; import com.airbnb.lottie.LottieImageAsset; import com.airbnb.lottie.utils.Logger; import com.airbnb.lottie.utils.Utils; + import java.io.IOException; import java.io.InputStream; import java.util.HashMap; @@ -122,8 +125,8 @@ public void setDelegate(@Nullable ImageAssetDelegate assetDelegate) { return null; } if (bitmap == null) { - Logger.warning("Decoded image is NULL."); - return null; + Logger.warning("Decoded image `" + id + "` is null."); + return null; } bitmap = Utils.resizeBitmapIfNeeded(bitmap, asset.getWidth(), asset.getHeight()); return putBitmap(id, bitmap);