mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-08-22 10:09:39 +00:00
Merge pull request #12455 from TobiGr/nextPage-nullable
This commit is contained in:
commit
c1cef19b33
@ -1089,15 +1089,25 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
|
|||||||
public void handleNextItems(final ListExtractor.InfoItemsPage<?> result) {
|
public void handleNextItems(final ListExtractor.InfoItemsPage<?> result) {
|
||||||
showListFooter(false);
|
showListFooter(false);
|
||||||
infoListAdapter.addInfoItemList(result.getItems());
|
infoListAdapter.addInfoItemList(result.getItems());
|
||||||
nextPage = result.getNextPage();
|
|
||||||
|
|
||||||
if (!result.getErrors().isEmpty() && nextPage != null) {
|
if (!result.getErrors().isEmpty()) {
|
||||||
|
// nextPage should be non-null at this point, because it refers to the page
|
||||||
|
// whose results are handled here, but let's check it anyway
|
||||||
|
if (nextPage == null) {
|
||||||
|
showSnackBarError(new ErrorInfo(result.getErrors(), UserAction.SEARCHED,
|
||||||
|
"\"" + searchString + "\" → nextPage == null", serviceId));
|
||||||
|
} else {
|
||||||
showSnackBarError(new ErrorInfo(result.getErrors(), UserAction.SEARCHED,
|
showSnackBarError(new ErrorInfo(result.getErrors(), UserAction.SEARCHED,
|
||||||
"\"" + searchString + "\" → pageUrl: " + nextPage.getUrl() + ", "
|
"\"" + searchString + "\" → pageUrl: " + nextPage.getUrl() + ", "
|
||||||
+ "pageIds: " + nextPage.getIds() + ", "
|
+ "pageIds: " + nextPage.getIds() + ", "
|
||||||
+ "pageCookies: " + nextPage.getCookies(),
|
+ "pageCookies: " + nextPage.getCookies(),
|
||||||
serviceId));
|
serviceId));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// keep the reassignment of nextPage after the error handling to ensure that nextPage
|
||||||
|
// still holds the correct value during the error handling
|
||||||
|
nextPage = result.getNextPage();
|
||||||
super.handleNextItems(result);
|
super.handleNextItems(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user