@@ -237,11 +237,11 @@ public void findEdgeIdsInNeighborhood(double queryLat, double queryLon, int iter
237
237
int subqueryY = y + yreg ;
238
238
int subqueryXA = x - iteration ;
239
239
int subqueryXB = x + iteration ;
240
- if (subqueryXA >= 0 && subqueryY >= 0 ) { // TODO: Also don't walk off the _other_ side of the grid.
240
+ if (subqueryXA >= 0 && subqueryY >= 0 && subqueryXA < indexStructureInfo . getParts () && subqueryY < indexStructureInfo . getParts ()) {
241
241
long keyPart = keyAlgo .encode (subqueryXA , subqueryY ) << (64 - keyAlgo .getBits ());
242
242
fillIDs (keyPart , foundEntries );
243
243
}
244
- if (iteration > 0 && subqueryXB >= 0 && subqueryY >= 0 ) {
244
+ if (iteration > 0 && subqueryXB >= 0 && subqueryY >= 0 && subqueryXB < indexStructureInfo . getParts () && subqueryY < indexStructureInfo . getParts () ) {
245
245
long keyPart = keyAlgo .encode (subqueryXB , subqueryY ) << (64 - keyAlgo .getBits ());
246
246
fillIDs (keyPart , foundEntries );
247
247
}
@@ -251,11 +251,11 @@ public void findEdgeIdsInNeighborhood(double queryLat, double queryLon, int iter
251
251
int subqueryX = x + xreg ;
252
252
int subqueryYA = y - iteration ;
253
253
int subqueryYB = y + iteration ;
254
- if (subqueryX >= 0 && subqueryYA >= 0 ) {
254
+ if (subqueryX >= 0 && subqueryYA >= 0 && subqueryX < indexStructureInfo . getParts () && subqueryYA < indexStructureInfo . getParts () ) {
255
255
long keyPart = keyAlgo .encode (subqueryX , subqueryYA ) << (64 - keyAlgo .getBits ());
256
256
fillIDs (keyPart , foundEntries );
257
257
}
258
- if (subqueryX >= 0 && subqueryYB >= 0 ) {
258
+ if (subqueryX >= 0 && subqueryYB >= 0 && subqueryX < indexStructureInfo . getParts () && subqueryYB < indexStructureInfo . getParts () ) {
259
259
long keyPart = keyAlgo .encode (subqueryX , subqueryYB ) << (64 - keyAlgo .getBits ());
260
260
fillIDs (keyPart , foundEntries );
261
261
}
0 commit comments