Skip to content

Commit a528cee

Browse files
authored
Merge pull request #8127 from litetex/fix-SparseItemUtil
Fix `SparseItemUtil` so we don't enqueue twice
2 parents e16917f + b5fa93e commit a528cee

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

app/src/main/java/org/schabi/newpipe/util/SparseItemUtil.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public static void fetchItemInfoIfSparse(@NonNull final Context context,
5454
// if the duration is >= 0 (provided that the item is not a livestream) and there is an
5555
// uploader url, probably all info is already there, so there is no need to fetch it
5656
callback.accept(new SinglePlayQueue(item));
57+
return;
5758
}
5859

5960
// either the duration or the uploader url are not available, so fetch more info
@@ -80,12 +81,12 @@ public static void fetchUploaderUrlIfSparse(@NonNull final Context context,
8081
@NonNull final String url,
8182
@Nullable final String uploaderUrl,
8283
@NonNull final Consumer<String> callback) {
83-
if (isNullOrEmpty(uploaderUrl)) {
84-
fetchStreamInfoAndSaveToDatabase(context, serviceId, url,
85-
streamInfo -> callback.accept(streamInfo.getUploaderUrl()));
86-
} else {
84+
if (!isNullOrEmpty(uploaderUrl)) {
8785
callback.accept(uploaderUrl);
86+
return;
8887
}
88+
fetchStreamInfoAndSaveToDatabase(context, serviceId, url,
89+
streamInfo -> callback.accept(streamInfo.getUploaderUrl()));
8990
}
9091

9192
/**

0 commit comments

Comments
 (0)