From fd2648df459e4cdc0089ea5119de6da349d211c5 Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Sun, 29 Jan 2023 16:31:16 +0100 Subject: [PATCH] made the checkSafeModeFile() crash-proof --- .../cloudstream3/plugins/PluginManager.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/plugins/PluginManager.kt b/app/src/main/java/com/lagradost/cloudstream3/plugins/PluginManager.kt index 28dfc092..3533d6a8 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/plugins/PluginManager.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/plugins/PluginManager.kt @@ -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 } /**