Skip to content

Commit

Permalink
Protect from Presenter not being initialized by setCallType.
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarty committed Nov 22, 2024
1 parent d577584 commit 75202f1
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import io.element.android.features.call.impl.pip.PictureInPictureState
import io.element.android.features.call.impl.pip.PipView
import io.element.android.features.call.impl.services.CallForegroundService
import io.element.android.features.call.impl.utils.CallIntentDataParser
import io.element.android.libraries.architecture.Presenter
import io.element.android.libraries.architecture.bindings
import io.element.android.libraries.core.log.logger.LoggerTag
import io.element.android.libraries.designsystem.theme.ElementThemeApp
Expand All @@ -62,7 +63,7 @@ class ElementCallActivity :
@Inject lateinit var appPreferencesStore: AppPreferencesStore
@Inject lateinit var pictureInPicturePresenter: PictureInPicturePresenter

private lateinit var presenter: CallScreenPresenter
private lateinit var presenter: Presenter<CallScreenState>

private lateinit var audioManager: AudioManager

Expand Down Expand Up @@ -92,6 +93,10 @@ class ElementCallActivity :
)

setCallType(intent)
// If presenter is not created at this point, it means we have no call to display, the Activity is finishing, so return early
if (!::presenter.isInitialized) {
return
}

if (savedInstanceState == null) {
updateUiMode(resources.configuration)
Expand Down

0 comments on commit 75202f1

Please sign in to comment.