Added null check to banned item check.

This commit is contained in:
high 2011-06-27 01:49:54 -04:00
parent c9cd8cb971
commit e465caa230
2 changed files with 6 additions and 5 deletions

View file

@ -35,5 +35,5 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.3.0.0625")] [assembly: AssemblyVersion("2.3.0.0627")]
[assembly: AssemblyFileVersion("2.3.0.0625")] [assembly: AssemblyFileVersion("2.3.0.0627")]

View file

@ -220,11 +220,12 @@ namespace TShockAPI
if (!player.Group.HasPermission("usebanneditem")) if (!player.Group.HasPermission("usebanneditem"))
{ {
for (int i = 0; i < Main.player[player.Index].inventory.Length; i++) var inv = Main.player[player.Index].inventory;
for (int i = 0; i < inv.Length; i++)
{ {
if (ItemManager.ItemIsBanned(Main.player[player.Index].inventory[i].name)) if (inv[i] != null && ItemManager.ItemIsBanned(inv[i].name))
{ {
player.Disconnect("Using banned item: " + Main.player[player.Index].inventory[i].name + ", remove it and rejoin"); player.Disconnect("Using banned item: " + inv[i].name + ", remove it and rejoin");
break; break;
} }
} }