瀏覽代碼

fix: NullPointerException

tongmengxiao 2 月之前
父節點
當前提交
cdd5d8acb8
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      baseswago/src/main/java/com/swago/baseswago/util/BitmapUtils.kt

+ 7 - 1
baseswago/src/main/java/com/swago/baseswago/util/BitmapUtils.kt

@@ -74,7 +74,13 @@ object BitmapUtils {
                     } finally {
                         outputStream?.close()
                     }
-                    response?.invoke(resource.apply { density = 480 })
+                    try {
+                        response?.invoke(resource.apply { density = 480 })
+                    } catch (e: NullPointerException){
+                        LogUtil.d("BitmapUtils", "NullPointerException in onResourceReady: ${e.message}")
+                        e.printStackTrace()
+                    }
+
                 }
 
                 override fun onLoadCleared(placeholder: Drawable?) {