feat: cover the scenario when team has less than 5 players
This commit is contained in:
parent
ef52e39c0d
commit
c10a667b8d
1 changed files with 2 additions and 1 deletions
|
@ -48,7 +48,8 @@ class MatchDetailsViewModel @Inject constructor(
|
|||
|
||||
private fun teamOrWithDefaultPlayers(team: Team?): Team? {
|
||||
return team?.let {
|
||||
if (it.players.isEmpty()) it.copy(players = List(5) { playerPlaceholder() }) else it
|
||||
val filledPlayers = it.players + List((5 - it.players.size).coerceAtLeast(0)) { playerPlaceholder() }
|
||||
it.copy(players = filledPlayers)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue