Skip to content

Commit

Permalink
Merge pull request #20652 from wordpress-mobile/issue/20647
Browse files Browse the repository at this point in the history
Fixes: NullPointerException in SiteCreationActivity
  • Loading branch information
zwarm authored Apr 17, 2024
2 parents 3f7287b + 141f222 commit 6ef913e
Showing 1 changed file with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class SiteCreationActivity : LocaleAwareActivity(),
mainViewModel.preloadThumbnails(this)

observeVMState()
observeOverlayEvents(savedInstanceState)
observeOverlayEvents()
}

override fun onSaveInstanceState(outState: Bundle) {
Expand Down Expand Up @@ -169,20 +169,13 @@ class SiteCreationActivity : LocaleAwareActivity(),
previewViewModel.onOkButtonClicked.observe(this, mainViewModel::onWizardFinished)
}

private fun observeOverlayEvents(savedInstanceState: Bundle?) {
private fun observeOverlayEvents() {
if(BuildConfig.IS_JETPACK_APP)
return

val fragment = if (savedInstanceState == null) {
JetpackFeatureFullScreenOverlayFragment
.newInstance(
isSiteCreationOverlay = true,
siteCreationSource = getSiteCreationSource()
)
}else {
supportFragmentManager.findFragmentByTag(JetpackFeatureFullScreenOverlayFragment.TAG)
as JetpackFeatureFullScreenOverlayFragment
}
val fragment = supportFragmentManager.findFragmentByTag(JetpackFeatureFullScreenOverlayFragment.TAG)
as? JetpackFeatureFullScreenOverlayFragment ?: JetpackFeatureFullScreenOverlayFragment
.newInstance(isSiteCreationOverlay = true, siteCreationSource = getSiteCreationSource())

jetpackFullScreenViewModel.action.observe(this) { action ->
if (mainViewModel.siteCreationDisabled) finish()
Expand Down

0 comments on commit 6ef913e

Please sign in to comment.