fix pages with events < maxevents

This commit is contained in:
akaessens 2020-09-27 15:18:48 +02:00
parent 3ba50f3df7
commit fea21a4c82
1 changed files with 12 additions and 4 deletions

View File

@ -74,11 +74,19 @@ public class FbPageScraper extends AsyncTask<Void, Void, Void> {
int max = shared_prefs.getInt("page_event_max", 5); int max = shared_prefs.getInt("page_event_max", 5);
if (event_links.size() < max) { if (event_links.size() < max) {
try {
String next_url = document String next_url = document
.getElementsByAttributeValueMatching("href", "has_more=1") .getElementsByAttributeValueMatching("href", "has_more=1")
.first().attr("href"); .first().attr("href");
this.url = "https://mbasic.facebook.com" + next_url; this.url = "https://mbasic.facebook.com" + next_url;
} catch (NullPointerException e) {
url = null;
event_links = event_links.subList(0, max);
}
} else { } else {
url = null; url = null;
event_links = event_links.subList(0, max); event_links = event_links.subList(0, max);