fix: 修复积分榜旧数据scoreDetail为null导致点击闪退的NPE

This commit is contained in:
flykhan 2026-04-26 17:41:45 +08:00
parent 2db44625bc
commit da9828f4b2
2 changed files with 2 additions and 2 deletions

View File

@ -39,7 +39,7 @@ data class ScoreEntry(
val playerCount: Int,
val turnNumber: Int,
val date: Long,
val scoreDetail: String = ""
val scoreDetail: String? = ""
)
object Scoreboard {

View File

@ -233,7 +233,7 @@ fun ScoreboardScreen(onBack: () -> Unit) {
// Detail dialog
if (showDetailDialog && detailEntry != null) {
val entry = detailEntry!!
val grouped = entry.scoreDetail.split(", ").filter { it.isNotEmpty() }
val grouped = (entry.scoreDetail ?: "").split(", ").filter { it.isNotEmpty() }
.groupBy { it }
.mapValues { it.value.size }
AlertDialog(