fix: (hopefully) i create a new voter list if it's empty instead of null ref
This commit is contained in:
parent
f379a3d5c8
commit
6840171608
@ -494,12 +494,17 @@ private void OnCurrentQuestionChanged(object sender, ValueChangedEventArgs onlin
|
||||
/// <param name="propositionNumber"></param>
|
||||
public void OnClickProposition(int propositionNumber)
|
||||
{
|
||||
/*
|
||||
Debug.Log($"Room has {myRoom.questions.Count} questions. the current Question is Q({myRoom.currentQuestionId}).");
|
||||
Debug.Log($"Q({myRoom.currentQuestionId}) has {myRoom.questions[myRoom.currentQuestionId].propositions.Count} propositions.");
|
||||
Debug.Log($"Player click on proposition {propositionNumber}.");
|
||||
Debug.Log($"it has {myRoom.questions[myRoom.currentQuestionId].propositions[propositionNumber].voters.Count} voters.");
|
||||
*/
|
||||
|
||||
List<string> voters = myRoom.questions[myRoom.currentQuestionId].propositions[propositionNumber].voters;
|
||||
if(voters == null)
|
||||
voters = new List<string>();
|
||||
|
||||
voters.Add(currentPlayer.id);
|
||||
myOnlineRoom.Child("questions").Child(myRoom.currentQuestionId.ToString()).Child("propositions").Child(propositionNumber.ToString()).Child("voters").SetValueAsync(voters);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user