Skip to content

Commit 1f88b6d

Browse files
Merge pull request commons-app#928 from RSBat/no-data-fix
Fixed issue commons-app#927
2 parents 7549638 + bd5b950 commit 1f88b6d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/src/main/java/fr/free/nrw/commons/nearby/NearbyPlaces.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ List<Place> getFromWikidataQuery(LatLng curLatLng, String lang) {
4646

4747
try {
4848
// increase the radius gradually to find a satisfactory number of nearby places
49-
while (radius < MAX_RADIUS) {
49+
while (radius <= MAX_RADIUS) {
5050
places = getFromWikidataQuery(curLatLng, lang, radius);
5151
Timber.d("%d results at radius: %f", places.size(), radius);
5252
if (places.size() >= MIN_RESULTS) {
@@ -62,6 +62,11 @@ List<Place> getFromWikidataQuery(LatLng curLatLng, String lang) {
6262
Timber.d("back to initial radius: %f", radius);
6363
radius = INITIAL_RADIUS;
6464
}
65+
// make sure we will be able to send at least one request next time
66+
if (radius > MAX_RADIUS) {
67+
radius = MAX_RADIUS;
68+
}
69+
6570
return places;
6671
}
6772

0 commit comments

Comments
 (0)