From 2b2179a1068f40edca8a989dbfe3b28335239829 Mon Sep 17 00:00:00 2001 From: Alex Hesketh Date: Thu, 22 Feb 2024 21:18:37 +0000 Subject: [PATCH] Don't always default to _Unknown_ player colour --- Website/Components/Dialogs/EditPlayDialog.razor | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Website/Components/Dialogs/EditPlayDialog.razor b/Website/Components/Dialogs/EditPlayDialog.razor index 706ebc9..73ba5bd 100644 --- a/Website/Components/Dialogs/EditPlayDialog.razor +++ b/Website/Components/Dialogs/EditPlayDialog.razor @@ -272,12 +272,16 @@ private void CreateNewPlayer() { - _play.Players.Add(new PlayerModel + var newPlayer = new PlayerModel { - Colour = Colours.FirstOrDefault(), Faction = Factions.FirstOrDefault(), Person = People.FirstOrDefault(x => _play.Players.All(y => x.Identifier != y.Person?.Identifier)) - }); + }; + if (newPlayer.Colour == null) + { + newPlayer.Colour = Colours.FirstOrDefault(); + } + _play.Players.Add(newPlayer); StateHasChanged(); }