From 714746ab6c85d18d6f979f7be5814a6a5316f887 Mon Sep 17 00:00:00 2001 From: Deathmax Date: Fri, 6 Jan 2012 21:58:51 +0800 Subject: [PATCH] TSHOCKPLUGINS-9 #close fixed Fixed. Workaround for REST meteor null reference exception crash. Requires an initializer for genRand if using any WorldGen methods in the future. --- TShockAPI/Rest/RestManager.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TShockAPI/Rest/RestManager.cs b/TShockAPI/Rest/RestManager.cs index b6b0a896..0d5e52f3 100644 --- a/TShockAPI/Rest/RestManager.cs +++ b/TShockAPI/Rest/RestManager.cs @@ -428,11 +428,11 @@ namespace TShockAPI private object WorldMeteor(RestVerbs verbs, IParameterCollection parameters) { + if (WorldGen.genRand == null) + WorldGen.genRand = new Random(); WorldGen.dropMeteor(); - var returnBlock = new Dictionary(); - returnBlock.Add("status", "200"); - returnBlock.Add("response", "Meteor has been spawned."); - return returnBlock; + var returnBlock = new Dictionary {{"status", "200"}, {"response", "Meteor has been spawned."}}; + return returnBlock; } private object WorldBloodmoon(RestVerbs verbs, IParameterCollection parameters)