Safer init

This commit is contained in:
self-similarity 2023-08-19 20:50:41 +02:00
parent 549eb87c9d
commit 855f806f56

View file

@ -1,6 +1,7 @@
package com.lagradost.cloudstream3 package com.lagradost.cloudstream3
import com.lagradost.cloudstream3.MainActivity.Companion.lastError import com.lagradost.cloudstream3.MainActivity.Companion.lastError
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.plugins.PluginManager.checkSafeModeFile import com.lagradost.cloudstream3.plugins.PluginManager.checkSafeModeFile
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@ -28,8 +29,16 @@ object NativeCrashHandler {
} }
fun initCrashHandler() { fun initCrashHandler() {
System.loadLibrary("native-lib") try {
initNativeCrashHandler() System.loadLibrary("native-lib")
initNativeCrashHandler()
} catch (t: Throwable) {
// Make debug crash.
if (BuildConfig.DEBUG) throw t
logError(t)
return
}
initSignalPolling() initSignalPolling()
} }
} }