Skip to content

Commit

Permalink
fix : 랭킹 키워드가 10개 이하일 때 발생하는 예외를 처리합니다.
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Diger committed Feb 27, 2024
1 parent 4fa0b7d commit 2a511e6
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ class CrawlerCore(
val sortedKeywords = keywordsCountingPair.toList().sortedByDescending { it.second }
val keywordRanking = StringBuilder()

for (rank: Int in 0..9) {
val rankingSize = if (sortedKeywords.size < 10) sortedKeywords.size else 10
for (rank: Int in 0 until rankingSize) {
keywordRanking.append(sortedKeywords[rank]).append(", ")
}

Expand Down

0 comments on commit 2a511e6

Please sign in to comment.