From bd2b32bfbc790c29f3b93dd8f0c232975622aac7 Mon Sep 17 00:00:00 2001 From: Peter Hindes Date: Mon, 14 Oct 2019 11:55:55 -0600 Subject: [PATCH] Fixed Playlists With No Uploader Crashing The App --- .../playlist/model/PlaylistRemoteEntity.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java index bf446ca1f..c6a96ec13 100644 --- a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java +++ b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.java @@ -16,6 +16,8 @@ import static org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity.RE import static org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity.REMOTE_PLAYLIST_TABLE; import static org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity.REMOTE_PLAYLIST_URL; +import android.text.TextUtils; + @Entity(tableName = REMOTE_PLAYLIST_TABLE, indices = { @Index(value = {REMOTE_PLAYLIST_NAME}), @@ -72,10 +74,18 @@ public class PlaylistRemoteEntity implements PlaylistLocalItem { @Ignore public boolean isIdenticalTo(final PlaylistInfo info) { - return getServiceId() == info.getServiceId() && getName().equals(info.getName()) && + boolean returnMe; + if (!TextUtils.isEmpty(getUploader())) { // If the playlist has an uploader + returnMe = getServiceId() == info.getServiceId() && getName().equals(info.getName()) && getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) && getThumbnailUrl().equals(info.getThumbnailUrl()) && getUploader().equals(info.getUploaderName()); + } else { // Else ignore uploader + returnMe = getServiceId() == info.getServiceId() && getName().equals(info.getName()) && + getStreamCount() == info.getStreamCount() && getUrl().equals(info.getUrl()) && + getThumbnailUrl().equals(info.getThumbnailUrl()); + } + return returnMe; } public long getUid() {