Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Commit 9e1f0f3

Browse files
committed
fix: return share clear bitmap when matte bitmap is null for avoiding crash.
1 parent 3df95bb commit 9e1f0f3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

library/src/main/java/com/opensource/svgaplayer/drawer/SVGACanvasDrawer.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ internal class SVGACanvasDrawer(videoItem: SVGAVideoEntity, val dynamicItem: SVG
339339
private val shareMattePaint = Paint()
340340
private var shareMatteCanvas: Canvas? = null
341341
private var sharedMatteBitmap: Bitmap? = null
342+
private var sharedClearBitmap = Bitmap.createBitmap(0, 0, Bitmap.Config.ALPHA_8)
342343

343344
fun sharedPaint(): Paint {
344345
sharedPaint.reset()
@@ -371,7 +372,10 @@ internal class SVGACanvasDrawer(videoItem: SVGAVideoEntity, val dynamicItem: SVG
371372
}
372373

373374
fun sharedMatteBitmap(): Bitmap {
374-
return sharedMatteBitmap as Bitmap
375+
sharedMatteBitmap?.let {
376+
return it
377+
}
378+
return sharedClearBitmap
375379
}
376380

377381
fun shareMatteCanvas(width: Int, height: Int): Canvas {

0 commit comments

Comments
 (0)