desktop: fix app without user crashing when trying to get subscription data (#4551)

This commit is contained in:
spaced4ndy
2024-08-01 08:05:35 +01:00
committed by GitHub
parent cbc86cd81e
commit 95de471754
2 changed files with 9 additions and 5 deletions
@@ -291,10 +291,12 @@ fun SubscriptionStatusIndicator(click: (() -> Unit)) {
val scope = rememberCoroutineScope()
suspend fun setSubsTotal() {
val r = chatModel.controller.getAgentSubsTotal(chatModel.remoteHostId())
if (r != null) {
subs = r.first
hasSess = r.second
if (chatModel.currentUser.value != null) {
val r = chatModel.controller.getAgentSubsTotal(chatModel.remoteHostId())
if (r != null) {
subs = r.first
hasSess = r.second
}
}
}
@@ -719,7 +719,9 @@ fun ModalData.ServersSummaryView(rh: RemoteHostInfo?, serversSummary: MutableSta
val scope = rememberCoroutineScope()
suspend fun setServersSummary() {
serversSummary.value = chatModel.controller.getAgentServersSummary(chatModel.remoteHostId())
if (chatModel.currentUser.value != null) {
serversSummary.value = chatModel.controller.getAgentServersSummary(chatModel.remoteHostId())
}
}
LaunchedEffect(Unit) {