fix: manage if one player did not send a propositon

This commit is contained in:
Fangh 2024-02-04 13:36:03 +01:00
parent a99f7dca5c
commit 5f0704c2f1

View File

@ -16,7 +16,6 @@ public class PropositionHandler : MonoBehaviour
public void ShowQuestion(Question currentQuestion) public void ShowQuestion(Question currentQuestion)
{ {
List<Proposition> props = currentQuestion.propositions.Values.ToList(); List<Proposition> props = currentQuestion.propositions.Values.ToList();
string enPrompt = prompts.GetPromptById(currentQuestion.promptId).en; string enPrompt = prompts.GetPromptById(currentQuestion.promptId).en;
promptLabel.text = enPrompt; promptLabel.text = enPrompt;
@ -24,6 +23,12 @@ public void ShowQuestion(Question currentQuestion)
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
int index = i; // Capture la valeur de i pour cette itération int index = i; // Capture la valeur de i pour cette itération
if(props[i].photoUrl == null)
{
Debug.Log("One player did not send a proposition !", this);
}
else
{
StorageManager.ConvertGoogleStorageURLToHttpsUrl(props[i].photoUrl, _httpURL => StorageManager.ConvertGoogleStorageURLToHttpsUrl(props[i].photoUrl, _httpURL =>
{ {
StartCoroutine(StorageManager.DownloadImage_Coroutine(_httpURL, (Texture texture) => StartCoroutine(StorageManager.DownloadImage_Coroutine(_httpURL, (Texture texture) =>
@ -33,6 +38,7 @@ public void ShowQuestion(Question currentQuestion)
})); }));
}); });
} }
}
} }