[SOLVED] Collision detection crash

I’m trying to make a simple (everything’s a 16x16 square) top-down game with Slick2D. My homebrew collision detection thingy works perfectly until the player moves upwards underneath a blocking hitbox - then the game stops responding and crashes with no error message. My moving code:

Input input = container.getInput();
if(input.isKeyDown(Input.KEY_UP) || input.isKeyDown(Input.KEY_W))
{
	y = hitbox.y = Collision.findNextAvailableY(x, y, (int)(hitbox.y - SPEED * delta));
}
if(input.isKeyDown(Input.KEY_LEFT) || input.isKeyDown(Input.KEY_A))
{
	x = hitbox.x = Collision.findNextAvailableX(x, y, (int)(hitbox.x - SPEED * delta));
}
if(input.isKeyDown(Input.KEY_RIGHT) || input.isKeyDown(Input.KEY_D))
{
	x = hitbox.x = Collision.findNextAvailableX(x, y, (int)(hitbox.x + SPEED * delta));
}
if(input.isKeyDown(Input.KEY_DOWN) || input.isKeyDown(Input.KEY_S))
{
	y = hitbox.y = Collision.findNextAvailableY(x, y, (int)(hitbox.y + SPEED * delta));
}

Collision.findNextAvailableY:

public static int findNextAvailableY(int x, int y, int newY)
{
	int newY_ = newY;
	
	if(y < newY)
	{
		while(isBlocked(new Rectangle(x, newY_, 16, 16)))
		{
			newY_--;
		}
	}
	else if(y > newY)
	{
		while(isBlocked(new Rectangle(x, newY_, 16, 16)))
		{
			newY++;
		}
	}
	
	return newY_;
}

Anyone got an idea what’s going on?