Verified Commit 27f00240 authored by Lars Mitsem Selbekk's avatar Lars Mitsem Selbekk
Browse files

Set score to 0 if null in leaderboard

parent 1700949b
Pipeline #175845 failed with stages
in 11 minutes and 29 seconds
......@@ -24,7 +24,12 @@ class LeaderboardState : GameState() {
private fun getUserScoreText(): String {
if (userId != null) {
val place = leaderboard.indexOfFirst { it.userId == userId }
if (place == -1) return ""
if (place == -1) {
MultiplayerService.incrementScore(0) {
updateLeaderboard()
}
return ""
}
val score = leaderboard[place].score
return "\n\nYou (no. ${place + 1}): $score"
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment