Fixed exceptions in NetLobbyScreen.UpdatePlayerFrame if job preferences contain jobs that aren't in the list of job prefabs

This commit is contained in:
Joonas Rikkonen
2017-06-11 18:49:48 +03:00
parent bf14882136
commit f469041363

View File

@@ -542,8 +542,11 @@ namespace Barotrauma
int i = 1;
foreach (string jobName in GameMain.Config.JobNamePreferences)
{
JobPrefab job = JobPrefab.List.First(x => x.Name == jobName);
if (job == null) { continue; }
JobPrefab job = JobPrefab.List.Find(x => x.Name == jobName);
if (job == null)
{
continue;
}
GUITextBlock jobText = new GUITextBlock(new Rectangle(0, 0, 0, 20), i + ". " + job.Name + " ",
"", Alignment.Left, Alignment.Right, jobList, false,