Missing null check in OnChat.
Added exception handler to command runner so it wont get swallowed by terraria
This commit is contained in:
parent
527d9bb203
commit
c52e8cbf5d
3 changed files with 24 additions and 7 deletions
|
|
@ -307,14 +307,14 @@ namespace TShockAPI
|
|||
if (Main.netMode != 2 || e.Handled)
|
||||
return;
|
||||
|
||||
if (msg.whoAmI != ply)
|
||||
var tsplr = Players[msg.whoAmI];
|
||||
|
||||
if (msg.whoAmI != ply || tsplr == null)
|
||||
{
|
||||
e.Handled = Tools.HandleGriefer(Players[ply], "Faking Chat");
|
||||
return;
|
||||
}
|
||||
|
||||
var tsplr = Players[msg.whoAmI];
|
||||
|
||||
if (tsplr.Group.HasPermission("adminchat") && !text.StartsWith("/"))
|
||||
{
|
||||
Tools.Broadcast(ConfigurationManager.AdminChatPrefix + "<" + tsplr.Name + "> " + text,
|
||||
|
|
@ -325,8 +325,15 @@ namespace TShockAPI
|
|||
|
||||
if (text.StartsWith("/"))
|
||||
{
|
||||
if (Commands.HandleCommand(tsplr, text))
|
||||
e.Handled = true;
|
||||
try
|
||||
{
|
||||
e.Handled = Commands.HandleCommand(tsplr, text);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.ConsoleError("Command exception");
|
||||
Log.Error(ex.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue