From b5fa93eda02aae2bc5f821ebf2150a481aab7a97 Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Wed, 30 Mar 2022 21:11:15 +0200 Subject: [PATCH] Fix `SparseItemUtil` loading * Added a missing `return` statement * `fetchUploaderUrlIfSparse` now has a similar layout to `fetchItemInfoIfSparse` --- .../java/org/schabi/newpipe/util/SparseItemUtil.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/util/SparseItemUtil.java b/app/src/main/java/org/schabi/newpipe/util/SparseItemUtil.java index 5daf7f073..b8cd4ef69 100644 --- a/app/src/main/java/org/schabi/newpipe/util/SparseItemUtil.java +++ b/app/src/main/java/org/schabi/newpipe/util/SparseItemUtil.java @@ -54,6 +54,7 @@ public final class SparseItemUtil { // if the duration is >= 0 (provided that the item is not a livestream) and there is an // uploader url, probably all info is already there, so there is no need to fetch it callback.accept(new SinglePlayQueue(item)); + return; } // either the duration or the uploader url are not available, so fetch more info @@ -80,12 +81,12 @@ public final class SparseItemUtil { @NonNull final String url, @Nullable final String uploaderUrl, @NonNull final Consumer callback) { - if (isNullOrEmpty(uploaderUrl)) { - fetchStreamInfoAndSaveToDatabase(context, serviceId, url, - streamInfo -> callback.accept(streamInfo.getUploaderUrl())); - } else { + if (!isNullOrEmpty(uploaderUrl)) { callback.accept(uploaderUrl); + return; } + fetchStreamInfoAndSaveToDatabase(context, serviceId, url, + streamInfo -> callback.accept(streamInfo.getUploaderUrl())); } /**