Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pycaching/geocaching.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,10 @@ def search(self, point, limit=float("inf")):
while True:
# get one page
geocaches_table, whole_page = self._search_get_page(point, start_index)
rows = geocaches_table.find_all("tr")

if not geocaches_table:
# result is empty - no more caches
# leave loop if there are no (more) results
if not rows:
return

# prepare language-dependent mappings
Expand All @@ -251,7 +252,7 @@ def search(self, point, limit=float("inf")):
}

# parse caches in result
for start_index, row in enumerate(geocaches_table.find_all("tr"), start_index):
for start_index, row in enumerate(rows, start_index):

limit -= 1 # handle limit
if limit < 0:
Expand Down