From 6b04bc79eb68212fd7ac5b6fe14af9c2d07351c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Sat, 30 Mar 2013 12:59:34 +0100 Subject: [PATCH] Fix crash without profiles. --- Vocaluxe/Screens/CScreenNames.cs | 7 +++++-- Vocaluxe/Screens/CScreenSing.cs | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index 26e71ab3..32ec3c6c 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -580,8 +580,11 @@ namespace Vocaluxe.Screens //Update texture and name if (CConfig.Players[i].Length > 0) { - Statics[StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; - Texts[TextPlayer[i]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; + if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) + { + Statics[StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; + Texts[TextPlayer[i]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; + } } if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) { diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 99f19377..da563a10 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -1342,7 +1342,7 @@ namespace Vocaluxe.Screens { for (int i = 0; i < CGame.NumPlayer; i++) { - if (CGame.Player[i].ProfileID > -1) + if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) Statics[StaticAvatars[i, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; else Statics[StaticAvatars[i, CGame.NumPlayer - 1]].Visible = false; @@ -1353,7 +1353,7 @@ namespace Vocaluxe.Screens { for (int i = 0; i < CGame.NumPlayer; i++) { - if (CGame.Player[i].ProfileID > -1) + if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) Texts[TextNames[i, CGame.NumPlayer - 1]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; else Texts[TextNames[i, CGame.NumPlayer - 1]].Visible = false;