out of range check when reading chat colors.

This commit is contained in:
Deathmax 2011-07-31 22:56:44 +08:00
parent 279b8ef9e2
commit 75f3d3c046

View file

@ -187,9 +187,12 @@ namespace TShockAPI.DB
group.AddPermission(commands[i].Trim()); group.AddPermission(commands[i].Trim());
} }
String[] chatcolour = reader.Get<String>("ChatColor").Split(','); String[] chatcolour = reader.Get<String>("ChatColor").Split(',');
if (chatcolour.Length == 3)
{
byte.TryParse(chatcolour[0], out group.R); byte.TryParse(chatcolour[0], out group.R);
byte.TryParse(chatcolour[1], out group.G); byte.TryParse(chatcolour[1], out group.G);
byte.TryParse(chatcolour[2], out group.B); byte.TryParse(chatcolour[2], out group.B);
}
groups.Add(group); groups.Add(group);
} }
} }