Use fatalError and add missing `return` statement

This commit is contained in:
Benoit Marty 2022-02-17 21:39:49 +01:00 committed by Benoit Marty
parent 26edf79aa2
commit e45c79378f
2 changed files with 3 additions and 5 deletions

View File

@ -55,6 +55,7 @@ import im.vector.app.core.di.ActiveSessionHolder
import im.vector.app.core.di.ActivityEntryPoint import im.vector.app.core.di.ActivityEntryPoint
import im.vector.app.core.dialogs.DialogLocker import im.vector.app.core.dialogs.DialogLocker
import im.vector.app.core.dialogs.UnrecognizedCertificateDialog import im.vector.app.core.dialogs.UnrecognizedCertificateDialog
import im.vector.app.core.error.fatalError
import im.vector.app.core.extensions.observeEvent import im.vector.app.core.extensions.observeEvent
import im.vector.app.core.extensions.observeNotNull import im.vector.app.core.extensions.observeNotNull
import im.vector.app.core.extensions.registerStartForActivityResult import im.vector.app.core.extensions.registerStartForActivityResult
@ -608,11 +609,7 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), Maver
} }
}.show() }.show()
} else { } else {
if (vectorPreferences.failFast()) { fatalError("No CoordinatorLayout to display this snackbar!", vectorPreferences.failFast())
error("No CoordinatorLayout to display this snackbar!")
} else {
Timber.w("No CoordinatorLayout to display this snackbar!")
}
} }
} }

View File

@ -316,6 +316,7 @@ class DefaultNavigator @Inject constructor(
if (context is AppCompatActivity) { if (context is AppCompatActivity) {
if (context !is MatrixToBottomSheet.InteractionListener) { if (context !is MatrixToBottomSheet.InteractionListener) {
fatalError("Caller context should implement MatrixToBottomSheet.InteractionListener", vectorPreferences.failFast()) fatalError("Caller context should implement MatrixToBottomSheet.InteractionListener", vectorPreferences.failFast())
return
} }
// TODO check if there is already one?? // TODO check if there is already one??
MatrixToBottomSheet.withLink(link, origin) MatrixToBottomSheet.withLink(link, origin)