From 76210a49a2efdb9a39c83fcbfe4e0edac954fd7a Mon Sep 17 00:00:00 2001 From: maxli Date: Wed, 22 Feb 2023 15:00:17 +0800 Subject: [PATCH] fix(android): drawPath CRASH_java.lang.NullPointerException --- .../views/asyncimage/BackgroundDrawable.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/android/sdk/src/main/java/com/tencent/mtt/supportui/views/asyncimage/BackgroundDrawable.java b/android/sdk/src/main/java/com/tencent/mtt/supportui/views/asyncimage/BackgroundDrawable.java index af4299bfe..eee665987 100644 --- a/android/sdk/src/main/java/com/tencent/mtt/supportui/views/asyncimage/BackgroundDrawable.java +++ b/android/sdk/src/main/java/com/tencent/mtt/supportui/views/asyncimage/BackgroundDrawable.java @@ -423,7 +423,7 @@ public class BackgroundDrawable extends BaseDrawable { // updateStyle border with radius path updatePath(); - + assert mPathForBorderRadius != null; // draw bg color boolean useGradientPaint = initGradientPaint(); if (useGradientPaint) { @@ -801,19 +801,15 @@ public class BackgroundDrawable extends BaseDrawable private void updatePath() { - if (!mNeedUpdateBorderPath) - { - return; - } - mNeedUpdateBorderPath = false; - if (mPathForBorderRadius == null) - { + if (mPathForBorderRadius == null) { mPathForBorderRadius = new Path(); mTempRectForBorderRadius = new RectF(); } - + if (!mNeedUpdateBorderPath) { + return; + } + mNeedUpdateBorderPath = false; mPathForBorderRadius.reset(); - mTempRectForBorderRadius.set(mRect); float fullBorderWidth = mBorderWidthArray == null ? 0 : mBorderWidthArray[0]; if (fullBorderWidth > 1)