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 * @return true if safe mode file is present
**/ **/
fun checkSafeModeFile(): Boolean { fun checkSafeModeFile(): Boolean {
val folder = File(CLOUD_STREAM_FOLDER) return normalSafeApiCall {
if (!folder.exists()) return false val folder = File(CLOUD_STREAM_FOLDER)
val files = folder.listFiles { _, name -> if (!folder.exists()) return@normalSafeApiCall false
name.equals("safe", ignoreCase = true) val files = folder.listFiles { _, name ->
} name.equals("safe", ignoreCase = true)
return files?.any() ?: false }
files?.any()
} ?: false
} }
/** /**