forked from recloudstream/cloudstream
made the checkSafeModeFile() crash-proof
This commit is contained in:
parent
9905618a47
commit
fd2648df45
1 changed files with 8 additions and 6 deletions
|
@ -428,12 +428,14 @@ object PluginManager {
|
||||||
* @return true if safe mode file is present
|
* @return true if safe mode file is present
|
||||||
**/
|
**/
|
||||||
fun checkSafeModeFile(): Boolean {
|
fun checkSafeModeFile(): Boolean {
|
||||||
|
return normalSafeApiCall {
|
||||||
val folder = File(CLOUD_STREAM_FOLDER)
|
val folder = File(CLOUD_STREAM_FOLDER)
|
||||||
if (!folder.exists()) return false
|
if (!folder.exists()) return@normalSafeApiCall false
|
||||||
val files = folder.listFiles { _, name ->
|
val files = folder.listFiles { _, name ->
|
||||||
name.equals("safe", ignoreCase = true)
|
name.equals("safe", ignoreCase = true)
|
||||||
}
|
}
|
||||||
return files?.any() ?: false
|
files?.any()
|
||||||
|
} ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue