Skip to content

Commit 994a4d4

Browse files
committed
bug-fix: imagePath maybe error.
1 parent e85c9b8 commit 994a4d4

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,17 @@ class SVGAVideoEntity(obj: JSONObject, val cacheDir: File) {
5252
val imgObjects = it
5353
it.keys().forEach {
5454
val imageKey = it
55-
val filePath = cacheDir.absolutePath + "/" + imgObjects[imageKey] + ".png"
56-
BitmapFactory.decodeFile(filePath)?.let {
57-
images.put(imageKey, it)
55+
var filePath = cacheDir.absolutePath + "/" + imgObjects[imageKey]
56+
var bitmap = BitmapFactory.decodeFile(filePath)
57+
if (bitmap != null) {
58+
images.put(imageKey, bitmap)
59+
}
60+
else {
61+
filePath = cacheDir.absolutePath + "/" + imageKey + ".png"
62+
bitmap = BitmapFactory.decodeFile(filePath)
63+
if (bitmap != null) {
64+
images.put(imageKey, bitmap)
65+
}
5866
}
5967
}
6068
}

0 commit comments

Comments
 (0)