Skip to content

Commit a4bd82b

Browse files
fix: handle nullable nextPage behavior when searching albums #12401 (#12408)
* fix: handle nullable nextPage behavior when searching albums #12401 * feat: add nullable annotation to newPage attribute in SearchFragment * Updated more usages of InfoItemsPage#getNextPage. Nullability is already handled in these areas so no other changes needed --------- Co-authored-by: Siddhesh Naik <[email protected]>
1 parent 45589db commit a4bd82b

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

app/src/main/java/org/schabi/newpipe/fragments/list/BaseListInfoFragment.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.view.View;
99

1010
import androidx.annotation.NonNull;
11+
import androidx.annotation.Nullable;
1112

1213
import com.evernote.android.state.State;
1314

@@ -42,6 +43,7 @@ public abstract class BaseListInfoFragment<I extends InfoItem, L extends ListInf
4243

4344
private final UserAction errorUserAction;
4445
protected L currentInfo;
46+
@Nullable
4547
protected Page currentNextPage;
4648
protected Disposable currentWorker;
4749

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
144144

145145
private final SparseArrayCompat<String> menuItemToFilterName = new SparseArrayCompat<>();
146146
private StreamingService service;
147+
@Nullable
147148
private Page nextPage;
148149
private boolean showLocalSuggestions = true;
149150
private boolean showRemoteSuggestions = true;
@@ -1090,7 +1091,7 @@ public void handleNextItems(final ListExtractor.InfoItemsPage<?> result) {
10901091
infoListAdapter.addInfoItemList(result.getItems());
10911092
nextPage = result.getNextPage();
10921093

1093-
if (!result.getErrors().isEmpty()) {
1094+
if (!result.getErrors().isEmpty() && nextPage != null) {
10941095
showSnackBarError(new ErrorInfo(result.getErrors(), UserAction.SEARCHED,
10951096
"\"" + searchString + "\" → pageUrl: " + nextPage.getUrl() + ", "
10961097
+ "pageIds: " + nextPage.getIds() + ", "

app/src/main/java/org/schabi/newpipe/player/playqueue/AbstractInfoPlayQueue.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.util.Log;
44

55
import androidx.annotation.NonNull;
6+
import androidx.annotation.Nullable;
67

78
import org.schabi.newpipe.extractor.InfoItem;
89
import org.schabi.newpipe.extractor.ListExtractor;
@@ -23,6 +24,7 @@ abstract class AbstractInfoPlayQueue<T extends ListInfo<? extends InfoItem>>
2324

2425
final int serviceId;
2526
final String baseUrl;
27+
@Nullable
2628
Page nextPage;
2729

2830
private transient Disposable fetchReactor;

0 commit comments

Comments
 (0)