mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 19:32:16 +00:00
Prevent DefaultInstaller from working on a non-existent cache file.
Ensures that the cache file exists before attempting an install using it. This fixes a crash that can occur if the file is not yet available, likely due to an I/O-related race condition.
This commit is contained in:
parent
3e8e23e111
commit
adf305ffc0
@ -51,6 +51,7 @@ class DefaultInstaller(context: Context) : BaseInstaller(context) {
|
||||
|
||||
val session = sessionInstaller.openSession(id)
|
||||
|
||||
if (cacheFile.exists()) {
|
||||
session.use { activeSession ->
|
||||
activeSession.openWrite("package", 0, cacheFile.length()).use { packageStream ->
|
||||
cacheFile.inputStream().use { fileStream ->
|
||||
@ -62,6 +63,7 @@ class DefaultInstaller(context: Context) : BaseInstaller(context) {
|
||||
|
||||
session.commit(pendingIntent.intentSender)
|
||||
}
|
||||
}
|
||||
cacheFile.delete()
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user