summaryrefslogtreecommitdiff
path: root/app/src/main/java/de
diff options
context:
space:
mode:
authorMartin Fietz <martin.fietz@gmail.com>2017-09-23 11:09:53 +0200
committerMartin Fietz <martin.fietz@gmail.com>2017-09-23 11:09:53 +0200
commit99588bb6f5d67fd6a0884dbddfb61c1a8cdf30b6 (patch)
tree92e7eae1f4731bc3ab5ecb3681df22385cd1fd80 /app/src/main/java/de
parent9c3a28f68b42ef0637fa59d8f4c4bbdd5a6df354 (diff)
downloadAntennaPod-99588bb6f5d67fd6a0884dbddfb61c1a8cdf30b6.zip
2423 Handle empty feed url in itunes search result
Diffstat (limited to 'app/src/main/java/de')
-rw-r--r--app/src/main/java/de/danoeh/antennapod/adapter/itunes/ItunesAdapter.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/itunes/ItunesAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/itunes/ItunesAdapter.java
index e381b4651..f1f8be559 100644
--- a/app/src/main/java/de/danoeh/antennapod/adapter/itunes/ItunesAdapter.java
+++ b/app/src/main/java/de/danoeh/antennapod/adapter/itunes/ItunesAdapter.java
@@ -2,6 +2,7 @@ package de.danoeh.antennapod.adapter.itunes;
import android.content.Context;
import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
@@ -69,7 +70,7 @@ public class ItunesAdapter extends ArrayAdapter<ItunesAdapter.Podcast> {
//Set the title
viewHolder.titleView.setText(podcast.title);
- if(!podcast.feedUrl.contains("itunes.apple.com")) {
+ if(podcast.feedUrl != null && !podcast.feedUrl.contains("itunes.apple.com")) {
viewHolder.urlView.setText(podcast.feedUrl);
viewHolder.urlView.setVisibility(View.VISIBLE);
} else {
@@ -102,14 +103,16 @@ public class ItunesAdapter extends ArrayAdapter<ItunesAdapter.Podcast> {
/**
* URL of the podcast image
*/
+ @Nullable
public final String imageUrl;
/**
* URL of the podcast feed
*/
+ @Nullable
public final String feedUrl;
- private Podcast(String title, String imageUrl, String feedUrl) {
+ private Podcast(String title, @Nullable String imageUrl, @Nullable String feedUrl) {
this.title = title;
this.imageUrl = imageUrl;
this.feedUrl = feedUrl;
@@ -122,9 +125,9 @@ public class ItunesAdapter extends ArrayAdapter<ItunesAdapter.Podcast> {
* @throws JSONException
*/
public static Podcast fromSearch(JSONObject json) throws JSONException {
- String title = json.getString("collectionName");
- String imageUrl = json.getString("artworkUrl100");
- String feedUrl = json.getString("feedUrl");
+ String title = json.optString("collectionName", "");
+ String imageUrl = json.optString("artworkUrl100", null);
+ String feedUrl = json.optString("feedUrl", null);
return new Podcast(title, imageUrl, feedUrl);
}