Skip to content

Commit b33896a

Browse files
committed
fix: app crash in playstore version on signup
Fixes: #1531 Changes: - Replace lateinit variables with null initialised variables to fix crash
1 parent d4e8f8c commit b33896a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

app/src/playStore/java/org/fossasia/openevent/general/search/SmartAuthViewModel.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ const val RC_CREDENTIALS_SAVE = 3
2323

2424
class SmartAuthViewModel : ViewModel() {
2525
private var requestedCredentialsEarlier = false
26-
private lateinit var credentialsClient: CredentialsClient
27-
private lateinit var signInClient: GoogleSignInClient
28-
private lateinit var thisActivity: Activity
26+
private var credentialsClient: CredentialsClient? = null
27+
private var signInClient: GoogleSignInClient? = null
28+
private var thisActivity: Activity? = null
2929
private val mutableId = MutableLiveData<String>()
3030
val id: LiveData<String> = mutableId
3131
private val mutablePassword = MutableLiveData<String>()
@@ -51,7 +51,7 @@ class SmartAuthViewModel : ViewModel() {
5151
.setPasswordLoginSupported(true)
5252
crBuilder.setAccountTypes(IdentityProviders.GOOGLE)
5353
mutableProgress.value = true
54-
credentialsClient.request(crBuilder.build()).addOnCompleteListener(
54+
credentialsClient?.request(crBuilder.build())?.addOnCompleteListener(
5555
OnCompleteListener<CredentialRequestResponse> { task ->
5656
requestedCredentialsEarlier = true
5757

@@ -73,7 +73,7 @@ class SmartAuthViewModel : ViewModel() {
7373
fun saveCredential (activity: Activity?, id: String, password: String) {
7474
if (activity == null) return
7575
val credential = Credential.Builder(id).setPassword(password).build()
76-
credentialsClient.save(credential).addOnCompleteListener(
76+
credentialsClient?.save(credential)?.addOnCompleteListener(
7777
OnCompleteListener<Void> { task ->
7878
if (task.isSuccessful)
7979
return@OnCompleteListener

0 commit comments

Comments
 (0)