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.
This commit is contained in:
Deathmax 2012-01-06 21:58:51 +08:00
parent 946bf2ad49
commit 714746ab6c

View file

@ -428,11 +428,11 @@ namespace TShockAPI
private object WorldMeteor(RestVerbs verbs, IParameterCollection parameters) private object WorldMeteor(RestVerbs verbs, IParameterCollection parameters)
{ {
if (WorldGen.genRand == null)
WorldGen.genRand = new Random();
WorldGen.dropMeteor(); WorldGen.dropMeteor();
var returnBlock = new Dictionary<string, string>(); var returnBlock = new Dictionary<string, string> {{"status", "200"}, {"response", "Meteor has been spawned."}};
returnBlock.Add("status", "200"); return returnBlock;
returnBlock.Add("response", "Meteor has been spawned.");
return returnBlock;
} }
private object WorldBloodmoon(RestVerbs verbs, IParameterCollection parameters) private object WorldBloodmoon(RestVerbs verbs, IParameterCollection parameters)