package yushijinhun.authlibagent.web.servlet;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import org.json.JSONObject;
import yushijinhun.authlibagent.api.web.response.GameProfileResponse;
import java.util.UUID;
import static yushijinhun.authlibagent.api.util.UUIDUtils.toUUID;

@WebServlet("/profiles/minecraft/*")
public class GameProfileServlet extends YggdrasilGetServlet {

	private static final long serialVersionUID = 1L;

	@Override
	protected JSONObject process(HttpServletRequest req) throws Exception {
		String path = req.getPathInfo().substring(1); // delete the / at the beginning
		if (path == null) {
			return null;
		}

		UUID profileUUID = toUUID(path);
		GameProfileResponse profile = backend.lookupProfile(profileUUID);

		return serializer.serializeGameProfile(profile, true);
	}

}

@@ -590,98 +590,101 @@
 fo()
-.substring(1); // delete the / at the beginning%0A%09%09if (path == null) %7B%0A%09%09%09return null;%0A%09%09%7D%0A
+;%0A%09%09if (path == null) %7B%0A%09%09%09return null;%0A%09%09%7D%0A%0A%09%09// substring() - delete the / at the beginning
 %0A%09%09U
@@ -712,16 +712,29 @@
 UID(path
+.substring(1)
 );%0A%09%09Gam

fix profile path null access