made the checkSafeModeFile() crash-proof

This commit is contained in:
Blatzar 2023-01-29 16:31:16 +01:00
parent 9905618a47
commit fd2648df45

View file

@ -428,12 +428,14 @@ object PluginManager {
* @return true if safe mode file is present
**/
fun checkSafeModeFile(): Boolean {
val folder = File(CLOUD_STREAM_FOLDER)
if (!folder.exists()) return false
val files = folder.listFiles { _, name ->
name.equals("safe", ignoreCase = true)
}
return files?.any() ?: false
return normalSafeApiCall {
val folder = File(CLOUD_STREAM_FOLDER)
if (!folder.exists()) return@normalSafeApiCall false
val files = folder.listFiles { _, name ->
name.equals("safe", ignoreCase = true)
}
files?.any()
} ?: false
}
/**