mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-18 01:05:10 +00:00
fix VancedDownloader lang npe
This commit is contained in:
parent
31162db145
commit
b7ba61b5e2
1 changed files with 7 additions and 5 deletions
|
@ -36,7 +36,7 @@ object VancedDownloader {
|
||||||
private var installUrl: String? = null
|
private var installUrl: String? = null
|
||||||
private var variant: String? = null
|
private var variant: String? = null
|
||||||
private var theme: String? = null
|
private var theme: String? = null
|
||||||
private var lang: MutableList<String>? = null
|
private var lang = mutableListOf<String>()
|
||||||
|
|
||||||
private lateinit var themePath: String
|
private lateinit var themePath: String
|
||||||
|
|
||||||
|
@ -56,7 +56,9 @@ object VancedDownloader {
|
||||||
downloadPath = context.getExternalFilesDir("vanced/$variant")?.path
|
downloadPath = context.getExternalFilesDir("vanced/$variant")?.path
|
||||||
File(downloadPath.toString()).deleteRecursively()
|
File(downloadPath.toString()).deleteRecursively()
|
||||||
installUrl = defPrefs.getInstallUrl()
|
installUrl = defPrefs.getInstallUrl()
|
||||||
lang = prefs.getString("lang", getDefaultVancedLanguages())?.split(", ")?.toMutableList()
|
prefs.getString("lang", getDefaultVancedLanguages())?.let {
|
||||||
|
lang = it.split(", ").toMutableList()
|
||||||
|
}
|
||||||
theme = prefs.getString("theme", "dark")
|
theme = prefs.getString("theme", "dark")
|
||||||
vancedVersion = defPrefs.getString("vanced_version", "latest")?.getLatestAppVersion(vancedVersions.get()?.value ?: listOf(""))
|
vancedVersion = defPrefs.getString("vanced_version", "latest")?.getLatestAppVersion(vancedVersions.get()?.value ?: listOf(""))
|
||||||
themePath = "$installUrl/apks/v$vancedVersion/$variant/Theme"
|
themePath = "$installUrl/apks/v$vancedVersion/$variant/Theme"
|
||||||
|
@ -112,7 +114,7 @@ object VancedDownloader {
|
||||||
"lang" -> {
|
"lang" -> {
|
||||||
count++
|
count++
|
||||||
succesfulLangCount++
|
succesfulLangCount++
|
||||||
if (count < lang?.size!!)
|
if (count < lang.size)
|
||||||
downloadSplits(context, "lang")
|
downloadSplits(context, "lang")
|
||||||
else
|
else
|
||||||
startVancedInstall(context)
|
startVancedInstall(context)
|
||||||
|
@ -132,9 +134,9 @@ object VancedDownloader {
|
||||||
if (type == "lang") {
|
if (type == "lang") {
|
||||||
count++
|
count++
|
||||||
when {
|
when {
|
||||||
count < lang?.size!! -> downloadSplits(context, "lang")
|
count < lang.size -> downloadSplits(context, "lang")
|
||||||
succesfulLangCount == 0 -> {
|
succesfulLangCount == 0 -> {
|
||||||
lang?.add("en")
|
lang.add("en")
|
||||||
downloadSplits(context, "lang")
|
downloadSplits(context, "lang")
|
||||||
}
|
}
|
||||||
else -> startVancedInstall(context)
|
else -> startVancedInstall(context)
|
||||||
|
|
Loading…
Reference in a new issue