From e465caa230a52d9d8944f2e44929dd1292670603 Mon Sep 17 00:00:00 2001 From: high Date: Mon, 27 Jun 2011 01:49:54 -0400 Subject: [PATCH] Added null check to banned item check. --- TShockAPI/Properties/AssemblyInfo.cs | 4 ++-- TShockAPI/TShock.cs | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index 37351868..9bbabf72 100644 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ using System.Runtime.InteropServices; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.3.0.0625")] -[assembly: AssemblyFileVersion("2.3.0.0625")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.0.0627")] +[assembly: AssemblyFileVersion("2.3.0.0627")] \ No newline at end of file diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 560b4b84..c666df6d 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -220,11 +220,12 @@ namespace TShockAPI 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; } }