diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 1efab2a3..46835113 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1380,11 +1380,17 @@ namespace TShockAPI } } } - + /// OnLeave - Called when a player leaves the server. /// args - The LeaveEventArgs object. private void OnLeave(LeaveEventArgs args) { + if (args.Who >= Players.Length || args.Who < 0) + { + //Something not right has happened + return; + } + var tsplr = Players[args.Who]; Players[args.Who] = null;