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 {
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
} }
/** /**