[Users | Trunk]: Fix exception when a user is not yer registered to openaire

This commit is contained in:
Konstantinos Triantafyllou 2021-01-22 16:12:44 +00:00
parent 230284002e
commit c7e62e2734
1 changed files with 7 additions and 1 deletions

View File

@ -62,7 +62,13 @@ public class RegistryCalls {
params.put("coid", coid); params.put("coid", coid);
params.put("mail", email); params.put("mail", email);
JsonElement response = httpUtils.get("co_people.json", params); JsonElement response = httpUtils.get("co_people.json", params);
return (response != null) ? response.getAsJsonObject().get("CoPeople").getAsJsonArray().get(0).getAsJsonObject().get("Id").getAsInt() : null; if(response != null) {
JsonArray coPeople = response.getAsJsonObject().get("CoPeople").getAsJsonArray();
if(coPeople.size() > 0) {
return coPeople.get(0).getAsJsonObject().get("Id").getAsInt();
}
}
return null;
} }
/** /**