Quick fix crash

This commit is contained in:
Niels Andriesse
2021-05-24 15:31:46 +10:00
parent 062f22071e
commit 550d8b61c7
4 changed files with 17 additions and 16 deletions

View File

@@ -14,8 +14,8 @@ class MessagingModuleConfiguration(
lateinit var shared: MessagingModuleConfiguration
fun configure(context: Context,
storage: StorageProtocol,
messageDataProvider: MessageDataProvider
storage: StorageProtocol,
messageDataProvider: MessageDataProvider
) {
if (Companion::shared.isInitialized) { return }
shared = MessagingModuleConfiguration(context, storage, messageDataProvider)

View File

@@ -373,8 +373,8 @@ object OnionRequestAPI {
}
val promise = deferred.promise
promise.fail { exception ->
val path = paths.firstOrNull { it.contains(guardSnode) }
if (exception is HTTP.HTTPRequestFailedException) {
if (exception is HTTP.HTTPRequestFailedException && SnodeModule.isInitialized) {
val path = paths.firstOrNull { it.contains(guardSnode) }
fun handleUnspecificError() {
if (path == null) { return }
var pathFailureCount = OnionRequestAPI.pathFailureCount[path] ?: 0

View File

@@ -8,8 +8,10 @@ class SnodeModule(val storage: LokiAPIDatabaseProtocol, val broadcaster: Broadca
companion object {
lateinit var shared: SnodeModule
val isInitialized: Boolean get() = Companion::shared.isInitialized
fun configure(storage: LokiAPIDatabaseProtocol, broadcaster: Broadcaster) {
if (Companion::shared.isInitialized) { return }
if (isInitialized) { return }
shared = SnodeModule(storage, broadcaster)
}
}