fix: if user has given no proposition

This commit is contained in:
Fangh 2024-01-28 16:23:53 +01:00
parent 44a0a3fb39
commit 7ab0ae9ac8
2 changed files with 19 additions and 3 deletions

View File

@ -22,8 +22,10 @@ public void Initialize(Proposition _proposition)
{
Debug.Log($"Initializing {_proposition.owner}'s proposition", this);
proposition = _proposition;
DisplayPicture(proposition.photoUrl);
playerName.text = proposition.owner.name;
if (!string.IsNullOrEmpty(proposition.photoUrl))
DisplayPicture(proposition.photoUrl);
}
private void DisplayPicture(string _url)

View File

@ -88,8 +88,22 @@ void ShowQuestion()
Debug.Log($"Prompt is {currentPromptLabel.text}", this);
if (currentQuestion.propositions[0] != null)
proposition1.Initialize(currentQuestion.propositions[0]);
proposition1.Initialize(currentQuestion.propositions[1]);
else
{
Debug.Log("User has given no proposition", this);
//manage if there is no proposition
}
if (currentQuestion.propositions[1] != null)
proposition2.Initialize(currentQuestion.propositions[1]);
else
{
Debug.Log("User has given no proposition", this);
//manage if there is no proposition
}
endOfTimer = DateTime.Now.AddSeconds(votingTime);
}