2
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-08-22 10:09:39 +00:00

Use correct fix for nextPage being null while creating error report in SearchFragment.handleNextItems()

This commit is contained in:
TobiGr 2025-07-22 16:03:37 +02:00
parent a4bd82be8a
commit 30e33d59e8

View File

@ -1089,8 +1089,9 @@ 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();
// nextPage should not be null here because it refers to the page
// which results are handled here, but we check it anyway
if (!result.getErrors().isEmpty() && nextPage != null) { if (!result.getErrors().isEmpty() && nextPage != null) {
showSnackBarError(new ErrorInfo(result.getErrors(), UserAction.SEARCHED, showSnackBarError(new ErrorInfo(result.getErrors(), UserAction.SEARCHED,
"\"" + searchString + "\" → pageUrl: " + nextPage.getUrl() + ", " "\"" + searchString + "\" → pageUrl: " + nextPage.getUrl() + ", "
@ -1098,6 +1099,10 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
+ "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);
} }