From 0ba826e1fdbe7b7ca11f336622fe860a5fa8e684 Mon Sep 17 00:00:00 2001 From: White Date: Tue, 17 Jan 2017 16:13:30 +1030 Subject: [PATCH] bandaid fix for invalid indexes in OnLeave --- TShockAPI/TShock.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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;