Skip to content

Commit 97955e5

Browse files
committed
[Bandcamp] Null-safe url catenation in track playlist
Previously, if no URL was provided due to the track being a preorder or unpaid track that doesn't have its own public page, we would catenate the artist URL and null to a nonsensical string. This invalid URL would also be used to try fetching a thumbnail URL. The downstream behavior of the NewPipe client is only marginally improved, as it now no longer throws visible exceptions due to the missing thumbnails, but still gives an unfriendly error upon clicking the item that has a `null` URL.
1 parent 4aaab63 commit 97955e5

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/streaminfoitem/BandcampPlaylistStreamInfoItemExtractor.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ public String getName() {
4343

4444
@Override
4545
public String getUrl() {
46-
return getUploaderUrl() + track.getString("title_link");
46+
final String relativeUrl = track.getString("title_link");
47+
if (relativeUrl != null) {
48+
return getUploaderUrl() + relativeUrl;
49+
} else {
50+
return null;
51+
}
4752
}
4853

4954
@Override
@@ -66,7 +71,7 @@ public String getUploaderName() {
6671
@Nonnull
6772
@Override
6873
public List<Image> getThumbnails() throws ParsingException {
69-
if (substituteCovers.isEmpty()) {
74+
if (substituteCovers.isEmpty() && getUrl() != null) {
7075
try {
7176
final StreamExtractor extractor = service.getStreamExtractor(getUrl());
7277
extractor.fetchPage();

0 commit comments

Comments
 (0)