package yushijinhun.authlibagent.web.yggdrasil.servlet;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import org.json.JSONArray;
import org.json.JSONObject;

@WebServlet("/yggdrasil/profilerepo/minecraft")
public class ProfileSearchServlet extends YggdrasilPostServlet {

	private static final long serialVersionUID = 1L;

	@Override
	protected JSONObject process(JSONArray req, HttpServletRequest rawReq) throws Exception {
		JSONObject resp = new JSONObject();
		JSONArray profilesResp = new JSONArray();
		for (Object o : req) {
			String name = (String) o;
			profilesResp.put(serializer.serializeGameProfile(backend.lookupProfile(name), false));
		}
		resp.put("profiles", profilesResp);
		return resp;
	}

}

@@ -194,16 +194,67 @@
 NObject;
+%0Aimport yushijinhun.authlibagent.model.GameProfile;
 %0A%0A@WebSe
@@ -650,16 +650,97 @@
 ing) o;%0A
+%09%09%09GameProfile profile = backend.lookupProfile(name);%0A%09%09%09if (profile != null) %7B%0A%09
 %09%09%09profi
@@ -787,35 +787,15 @@
 ile(
-backend.lookupProfile(name)
+profile
 , fa
@@ -801,16 +801,21 @@
 alse));%0A
+%09%09%09%7D%0A
 %09%09%7D%0A%09%09re

add null checks