This repository was archived by the owner on Feb 6, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
library/src/main/java/com/opensource/svgaplayer Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ object SVGACache {
23
23
if (isInitialized()) return
24
24
context ? : return
25
25
cacheDir = " ${context.cacheDir.absolutePath} /svga/"
26
- File (cacheDir).takeIf { ! it.exists() }?.mkdir ()
26
+ File (cacheDir).takeIf { ! it.exists() }?.mkdirs ()
27
27
this .type = type
28
28
}
29
29
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import android.content.Context
4
4
import android.net.http.HttpResponseCache
5
5
import android.os.Handler
6
6
import android.os.Looper
7
+ import android.util.Log
7
8
import com.opensource.svgaplayer.proto.MovieEntity
8
9
import com.opensource.svgaplayer.utils.log.LogUtils
9
10
import org.json.JSONObject
@@ -237,8 +238,13 @@ class SVGAParser(context: Context?) {
237
238
readAsBytes(inputStream)?.let { bytes ->
238
239
threadPoolExecutor.execute {
239
240
SVGACache .buildSvgaFile(cacheKey).let { cacheFile ->
240
- cacheFile.takeIf { ! it.exists() }?.createNewFile()
241
- FileOutputStream (cacheFile).write(bytes)
241
+ try {
242
+ cacheFile.takeIf { ! it.exists() }?.createNewFile()
243
+ FileOutputStream (cacheFile).write(bytes)
244
+ } catch (e: Exception ) {
245
+ LogUtils .error(TAG , " create cache file fail." , e)
246
+ cacheFile.delete()
247
+ }
242
248
}
243
249
}
244
250
LogUtils .info(TAG , " Input.inflate start" )
You can’t perform that action at this time.
0 commit comments