Skip to content

Commit

Permalink
fix(android): drawPath CRASH_java.lang.NullPointerException
Browse files Browse the repository at this point in the history
  • Loading branch information
siguangli2018 authored and zoomchan-cxj committed Mar 16, 2023
1 parent df4d7ea commit 76210a4
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ private void drawBGWithRadius(Canvas canvas)
{
// updateStyle border with radius path
updatePath();

assert mPathForBorderRadius != null;
// draw bg color
boolean useGradientPaint = initGradientPaint();
if (useGradientPaint) {
Expand Down Expand Up @@ -801,19 +801,15 @@ public Bitmap generateBitmap(int width, int height) {

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)
Expand Down

0 comments on commit 76210a4

Please sign in to comment.