fix: 修复积分榜旧数据scoreDetail为null导致点击闪退的NPE
This commit is contained in:
parent
2db44625bc
commit
da9828f4b2
@ -39,7 +39,7 @@ data class ScoreEntry(
|
||||
val playerCount: Int,
|
||||
val turnNumber: Int,
|
||||
val date: Long,
|
||||
val scoreDetail: String = ""
|
||||
val scoreDetail: String? = ""
|
||||
)
|
||||
|
||||
object Scoreboard {
|
||||
|
||||
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user