diff --git a/discussion/src/main/java/org/openedx/discussion/presentation/threads/DiscussionAddThreadViewModel.kt b/discussion/src/main/java/org/openedx/discussion/presentation/threads/DiscussionAddThreadViewModel.kt index 8a3a2417d..b16b9f300 100644 --- a/discussion/src/main/java/org/openedx/discussion/presentation/threads/DiscussionAddThreadViewModel.kt +++ b/discussion/src/main/java/org/openedx/discussion/presentation/threads/DiscussionAddThreadViewModel.kt @@ -65,9 +65,8 @@ class DiscussionAddThreadViewModel( } fun getHandledTopicById(topicId: String): Pair { - return getHandledTopics() - .find { it.second == topicId } - ?: getHandledTopics()[0] + val topics = getHandledTopics() + return topics.find { it.second == topicId } ?: topics.firstOrNull() ?: Pair("", "") } fun sendThreadAdded() {