Skip to content

Commit

Permalink
fix: crash when trying to get first topic in list (openedx#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
dixidroid authored Nov 18, 2024
1 parent c6b8fa5 commit b892560
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ class DiscussionAddThreadViewModel(
}

fun getHandledTopicById(topicId: String): Pair<String, String> {
return getHandledTopics()
.find { it.second == topicId }
?: getHandledTopics()[0]
val topics = getHandledTopics()
return topics.find { it.second == topicId } ?: topics.firstOrNull() ?: Pair("", "")
}

fun sendThreadAdded() {
Expand Down

0 comments on commit b892560

Please sign in to comment.