Replace non null check with early return if null

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2023-01-26 14:09:50 +01:00 committed by Marcel Hibbe
parent 747a4646d3
commit b07aaee140
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -2147,15 +2147,17 @@ class ChatController(args: Bundle) :
}
private fun setupWebsocket() {
if (conversationUser != null) {
webSocketInstance =
if (WebSocketConnectionHelper.getMagicWebSocketInstanceForUserId(conversationUser.id!!) != null) {
WebSocketConnectionHelper.getMagicWebSocketInstanceForUserId(conversationUser.id!!)
} else {
Log.d(TAG, "magicWebSocketInstance became null")
null
}
if (conversationUser == null) {
return
}
webSocketInstance =
if (WebSocketConnectionHelper.getMagicWebSocketInstanceForUserId(conversationUser.id!!) != null) {
WebSocketConnectionHelper.getMagicWebSocketInstanceForUserId(conversationUser.id!!)
} else {
Log.d(TAG, "magicWebSocketInstance became null")
null
}
}
fun pullChatMessages(lookIntoFuture: Int, setReadMarker: Int = 1, xChatLastCommonRead: Int? = null) {