Only attempt to authenticate when connection is not null (#2058)

This commit is contained in:
Daniel Shokouhi 2021-12-22 09:36:56 -08:00 committed by GitHub
parent c46b05fe02
commit 077b4ab368
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -213,14 +213,17 @@ class WebSocketRepositoryImpl @Inject constructor(
}
private suspend fun authenticate() {
connection!!.send(
mapper.writeValueAsString(
mapOf(
"type" to "auth",
"access_token" to authenticationRepository.retrieveAccessToken()
if (connection != null) {
connection!!.send(
mapper.writeValueAsString(
mapOf(
"type" to "auth",
"access_token" to authenticationRepository.retrieveAccessToken()
)
)
)
)
} else
Log.e(TAG, "Attempted to authenticate when connection is null")
}
private fun handleAuthComplete(successful: Boolean) {