Fix for null reference exceptions from REST
This commit is contained in:
parent
f264e2b060
commit
fe670bc18f
1 changed files with 8 additions and 0 deletions
|
|
@ -24,6 +24,7 @@ using HttpServer;
|
|||
using TShockAPI;
|
||||
using TShockAPI.DB;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
|
||||
namespace Rests
|
||||
{
|
||||
|
|
@ -199,6 +200,13 @@ namespace Rests
|
|||
{ Error = string.Format("Not authorized. User \"{0}\" has no access to use the specified API endpoint.", tokenData.Username) };
|
||||
}
|
||||
|
||||
//Main.rand being null can cause issues in command execution.
|
||||
//This should solve that
|
||||
if (Main.rand == null)
|
||||
{
|
||||
Main.rand = new Terraria.Utilities.UnifiedRandom();
|
||||
}
|
||||
|
||||
object result = secureCmd.Execute(verbs, parms, tokenData, request, context);
|
||||
if (cmd.DoLog && TShock.Config.LogRest)
|
||||
TShock.Utils.SendLogs(string.Format(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue