(assistant) Add bounds checks for domain idx

This commit is contained in:
Viktor Lofgren 2024-09-27 14:24:04 +02:00
parent 3566fe296a
commit ca27d95ce1

View File

@ -195,9 +195,14 @@ public class SimilarDomainsService {
public List<RpcSimilarDomain> getSimilarDomains(int domainId, int count) {
int domainIdx = domainIdToIdx.get(domainId);
if (domainNeighbors.length >= domainIdx) {
return List.of();
}
TIntList allIdsList = domainNeighbors[domainIdx];
if (allIdsList == null)
return List.of();
TIntList allIds = new TIntArrayList(new TIntHashSet(allIdsList));
TIntSet linkingIdsDtoS = getLinkingIdsDToS(domainIdx);