Skip to content

Commit 30e33d5

Browse files
committed
Use correct fix for nextPage being null while creating error report in SearchFragment.handleNextItems()
1 parent a4bd82b commit 30e33d5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,15 +1089,20 @@ private void handleSearchSuggestion() {
10891089
public void handleNextItems(final ListExtractor.InfoItemsPage<?> result) {
10901090
showListFooter(false);
10911091
infoListAdapter.addInfoItemList(result.getItems());
1092-
nextPage = result.getNextPage();
10931092

1093+
// nextPage should not be null here because it refers to the page
1094+
// which results are handled here, but we check it anyway
10941095
if (!result.getErrors().isEmpty() && nextPage != null) {
10951096
showSnackBarError(new ErrorInfo(result.getErrors(), UserAction.SEARCHED,
10961097
"\"" + searchString + "\" → pageUrl: " + nextPage.getUrl() + ", "
10971098
+ "pageIds: " + nextPage.getIds() + ", "
10981099
+ "pageCookies: " + nextPage.getCookies(),
10991100
serviceId));
11001101
}
1102+
1103+
// keep the reassignment of nextPage after the error handling to ensure that nextPage
1104+
// still holds the correct value during the error handling
1105+
nextPage = result.getNextPage();
11011106
super.handleNextItems(result);
11021107
}
11031108

0 commit comments

Comments
 (0)