bugfix: Share Episode URL - handle empty link

This commit is contained in:
orionlee 2019-10-17 12:32:06 -07:00
parent 2ffdc275b8
commit 5eaa4dbfb1
2 changed files with 6 additions and 3 deletions

View File

@ -64,6 +64,7 @@ import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import org.apache.commons.lang3.StringUtils;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
@ -504,7 +505,7 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
private static String getWebsiteLinkWithFallback(Playable media) {
if (media == null) {
return null;
} else if (media.getWebsiteLink() != null) {
} else if (StringUtils.isNotBlank(media.getWebsiteLink())) {
return media.getWebsiteLink();
} else if (media instanceof FeedMedia) {
return FeedItemUtil.getLinkWithFallback(((FeedMedia)media).getItem());

View File

@ -1,5 +1,7 @@
package de.danoeh.antennapod.core.util;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
import de.danoeh.antennapod.core.feed.FeedItem;
@ -45,9 +47,9 @@ public class FeedItemUtil {
public static String getLinkWithFallback(FeedItem item) {
if (item == null) {
return null;
} else if (item.getLink() != null) {
} else if (StringUtils.isNotBlank(item.getLink())) {
return item.getLink();
} else if (item.getFeed() != null) {
} else if (StringUtils.isNotBlank(item.getFeed().getLink())) {
return item.getFeed().getLink();
}
return null;