Closed FourierTransformer closed 9 years ago
Woah! That is a huge bug will try to fix that asap!
@FourierTransformer I can't reproduce by sending an empty a null/empty direction. There is some check logic that makes sure a direction is valid already.
if (updateRequest.MoveAntRequests.Any(ma => ma.Direction == "up" || ma.Direction == "down" || ma.Direction == "left" || ma.Direction == "right"))
{
return true;
}
Is it possible you are sending an invalid gameid as well? Cause I can definitely get the server to crash then.
it is entirely possible - an algo was going ham at the time and returning null values all over the place. I only checked the direction to confirm suspicion - but yeah Entirely possible.
Actually hold that thought, just rolled back to the commit. Here's the relevant json:
"MoveAntRequests":[{"antId":6},{"antId":3,"direction":"down"},{"antId":9,"direction":"right"},{"antId":1,"direction":"right"}]
it complains about antId:6 and errors out on the direction=direction.ToLower()
in Board.cs because there is no direction associated.
private void UpdateAnt(Game game, int antId, string direction)
{
direction = direction.ToLower();
var ant = Ants.FirstOrDefault(a => a.Id == antId);
if (ant != null)
{
var newX = ant.X;
@FourierTransformer Oh yeah, definitely an issue
Just send an antid with a null/empty direction to api/game/update and it'll crash the server and all running games. FUN STUFFS!