Skip to content

Commit 5735cff

Browse files
committed
bug-fix: NPE crash while view remove before onComplete.
1 parent 6dda8b0 commit 5735cff

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/src/main/java/com/opensource/svgaplayer/SVGAImageView.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ open class SVGAImageView : ImageView {
112112
URL(it)?.let {
113113
parser.parse(it, object : SVGAParser.ParseCompletion {
114114
override fun onComplete(videoItem: SVGAVideoEntity) {
115-
handler.post {
115+
handler?.post {
116116
videoItem.antiAlias = antiAlias
117117
setVideoItem(videoItem)
118118
if (typedArray.getBoolean(R.styleable.SVGAImageView_autoPlay, true)) {
@@ -127,7 +127,7 @@ open class SVGAImageView : ImageView {
127127
}
128128
parser.parse(it, object : SVGAParser.ParseCompletion {
129129
override fun onComplete(videoItem: SVGAVideoEntity) {
130-
handler.post {
130+
handler?.post {
131131
videoItem.antiAlias = antiAlias
132132
setVideoItem(videoItem)
133133
if (typedArray.getBoolean(R.styleable.SVGAImageView_autoPlay, true)) {

0 commit comments

Comments
 (0)