2
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-08-22 01:58:16 +00:00

Improve null checking further in SearchFragment.handleNextItems

This commit is contained in:
Stypox 2025-07-28 14:43:46 +02:00
parent 30e33d59e8
commit 9ba30887f9
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23

View File

@ -1090,14 +1090,19 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
showListFooter(false); showListFooter(false);
infoListAdapter.addInfoItemList(result.getItems()); infoListAdapter.addInfoItemList(result.getItems());
// nextPage should not be null here because it refers to the page if (!result.getErrors().isEmpty()) {
// which results are handled here, but we check it anyway // nextPage should be non-null at this point, because it refers to the page
if (!result.getErrors().isEmpty() && nextPage != null) { // whose results are handled here, but let's check it anyway
showSnackBarError(new ErrorInfo(result.getErrors(), UserAction.SEARCHED, if (nextPage == null) {
"\"" + searchString + "\" → pageUrl: " + nextPage.getUrl() + ", " showSnackBarError(new ErrorInfo(result.getErrors(), UserAction.SEARCHED,
+ "pageIds: " + nextPage.getIds() + ", " "\"" + searchString + "\" → nextPage == null", serviceId));
+ "pageCookies: " + nextPage.getCookies(), } else {
serviceId)); showSnackBarError(new ErrorInfo(result.getErrors(), UserAction.SEARCHED,
"\"" + searchString + "\" → pageUrl: " + nextPage.getUrl() + ", "
+ "pageIds: " + nextPage.getIds() + ", "
+ "pageCookies: " + nextPage.getCookies(),
serviceId));
}
} }
// keep the reassignment of nextPage after the error handling to ensure that nextPage // keep the reassignment of nextPage after the error handling to ensure that nextPage