diff --git a/Assets/Scripts/PropositionHandler.cs b/Assets/Scripts/PropositionHandler.cs index 5542af2..2e80919 100644 --- a/Assets/Scripts/PropositionHandler.cs +++ b/Assets/Scripts/PropositionHandler.cs @@ -16,7 +16,6 @@ public class PropositionHandler : MonoBehaviour public void ShowQuestion(Question currentQuestion) { - List props = currentQuestion.propositions.Values.ToList(); string enPrompt = prompts.GetPromptById(currentQuestion.promptId).en; promptLabel.text = enPrompt; @@ -24,14 +23,21 @@ public void ShowQuestion(Question currentQuestion) for (int i = 0; i < 2; i++) { int index = i; // Capture la valeur de i pour cette itération - StorageManager.ConvertGoogleStorageURLToHttpsUrl(props[i].photoUrl, _httpURL => + if(props[i].photoUrl == null) { - StartCoroutine(StorageManager.DownloadImage_Coroutine(_httpURL, (Texture texture) => + Debug.Log("One player did not send a proposition !", this); + } + else + { + StorageManager.ConvertGoogleStorageURLToHttpsUrl(props[i].photoUrl, _httpURL => { - Sprite sprite = Sprite.Create(texture as Texture2D, new Rect(0, 0, texture.width, texture.height), Vector2.zero); - btns[index].sprite = sprite; // Utilise l'index local au lieu de i - })); - }); + StartCoroutine(StorageManager.DownloadImage_Coroutine(_httpURL, (Texture texture) => + { + Sprite sprite = Sprite.Create(texture as Texture2D, new Rect(0, 0, texture.width, texture.height), Vector2.zero); + btns[index].sprite = sprite; // Utilise l'index local au lieu de i + })); + }); + } } }