From 29d35725074229fe997903cff3b3f9154f3556d4 Mon Sep 17 00:00:00 2001 From: andrekir Date: Mon, 8 May 2023 17:33:21 -0300 Subject: [PATCH] fix: replace filterNotNull() with null check --- app/src/main/java/com/geeksville/mesh/model/UIState.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/geeksville/mesh/model/UIState.kt b/app/src/main/java/com/geeksville/mesh/model/UIState.kt index 7dfee536..ec642e51 100644 --- a/app/src/main/java/com/geeksville/mesh/model/UIState.kt +++ b/app/src/main/java/com/geeksville/mesh/model/UIState.kt @@ -40,7 +40,6 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow -import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.launchIn @@ -157,8 +156,9 @@ class UIViewModel @Inject constructor( _ourNodeInfo.value = it }.launchIn(viewModelScope) - combine(meshLog, requestId.filterNotNull()) { packet, id -> - _packetResponse.value = packet.firstOrNull { it.meshPacket?.decoded?.requestId == id } + combine(meshLog, requestId) { packet, requestId -> + if (requestId != null) _packetResponse.value = + packet.firstOrNull { it.meshPacket?.decoded?.requestId == requestId } }.launchIn(viewModelScope) debug("ViewModel created")