GetOngoingVoiceBroadcastsUseCase: Return empty list if there is no session

This commit is contained in:
Florian Renaud 2022-10-26 16:08:03 +02:00
parent c20f6fe326
commit cb5fc75c5d

View File

@ -31,8 +31,11 @@ class GetOngoingVoiceBroadcastsUseCase @Inject constructor(
) {
fun execute(roomId: String): List<VoiceBroadcastEvent> {
val session = activeSessionHolder.getSafeActiveSession()
val room = session?.getRoom(roomId) ?: error("Unknown roomId: $roomId")
val session = activeSessionHolder.getSafeActiveSession() ?: run {
Timber.d("## GetOngoingVoiceBroadcastsUseCase: no active session")
return emptyList()
}
val room = session.getRoom(roomId) ?: error("Unknown roomId: $roomId")
Timber.d("## GetLastVoiceBroadcastUseCase: get last voice broadcast in $roomId")