Skip to content

Commit

Permalink
fix: crash when trying to get first topic in list
Browse files Browse the repository at this point in the history
  • Loading branch information
dixidroid committed Nov 14, 2024
1 parent 88dfc54 commit fcaf563
Showing 1 changed file with 3 additions and 4 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 All @@ -76,4 +75,4 @@ class DiscussionAddThreadViewModel(
}
}

}
}

0 comments on commit fcaf563

Please sign in to comment.