@@ -1089,15 +1089,25 @@ private void handleSearchSuggestion() {
10891089 public void handleNextItems (final ListExtractor .InfoItemsPage <?> result ) {
10901090 showListFooter (false );
10911091 infoListAdapter .addInfoItemList (result .getItems ());
1092- nextPage = result .getNextPage ();
10931092
1094- if (!result .getErrors ().isEmpty () && nextPage != null ) {
1095- showSnackBarError (new ErrorInfo (result .getErrors (), UserAction .SEARCHED ,
1096- "\" " + searchString + "\" → pageUrl: " + nextPage .getUrl () + ", "
1097- + "pageIds: " + nextPage .getIds () + ", "
1098- + "pageCookies: " + nextPage .getCookies (),
1099- serviceId ));
1093+ if (!result .getErrors ().isEmpty ()) {
1094+ // nextPage should be non-null at this point, because it refers to the page
1095+ // whose results are handled here, but let's check it anyway
1096+ if (nextPage == null ) {
1097+ showSnackBarError (new ErrorInfo (result .getErrors (), UserAction .SEARCHED ,
1098+ "\" " + searchString + "\" → nextPage == null" , serviceId ));
1099+ } else {
1100+ showSnackBarError (new ErrorInfo (result .getErrors (), UserAction .SEARCHED ,
1101+ "\" " + searchString + "\" → pageUrl: " + nextPage .getUrl () + ", "
1102+ + "pageIds: " + nextPage .getIds () + ", "
1103+ + "pageCookies: " + nextPage .getCookies (),
1104+ serviceId ));
1105+ }
11001106 }
1107+
1108+ // keep the reassignment of nextPage after the error handling to ensure that nextPage
1109+ // still holds the correct value during the error handling
1110+ nextPage = result .getNextPage ();
11011111 super .handleNextItems (result );
11021112 }
11031113
0 commit comments