Skip to content

Commit 08ec9e7

Browse files
authored
Merge pull request #20450 from wordpress-mobile/issue/20354-fix-crash-on-domain-selection-screen
Fix crash on the domain selection screen
2 parents aeb40f8 + bf0c79c commit 08ec9e7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

WordPress/src/main/java/org/wordpress/android/ui/sitecreation/domains/SiteCreationDomainsViewModel.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,10 @@ class SiteCreationDomainsViewModel @Inject constructor(
130130
}
131131

132132
fun onCreateSiteBtnClicked() {
133-
val domain = requireNotNull(selectedDomain) {
134-
"Create site button should not be visible if a domain is not selected"
135-
}
136-
tracker.trackDomainSelected(domain.domainName, currentQuery?.value.orEmpty(), domain.cost, domain.isFree)
137-
_createSiteBtnClicked.value = domain
133+
selectedDomain?.let { domain ->
134+
tracker.trackDomainSelected(domain.domainName, currentQuery?.value.orEmpty(), domain.cost, domain.isFree)
135+
_createSiteBtnClicked.value = domain
136+
} // selectedDomain is null if the query has been asynchronously updated and the domain list has been changed.
138137
}
139138

140139
fun onClearTextBtnClicked() = _clearBtnClicked.call()

0 commit comments

Comments
 (0)