From 9301a3bd98083ce82c414bc1927be960584f89dd Mon Sep 17 00:00:00 2001 From: Tom Hennen Date: Thu, 28 May 2015 17:49:59 -0400 Subject: [PATCH 1/3] fix NPE in FeedInfoActivity --- .../de/danoeh/antennapod/activity/FeedInfoActivity.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java index 24b684752..9a45b7db3 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java @@ -120,7 +120,11 @@ public class FeedInfoActivity extends ActionBarActivity { }); txtvTitle.setText(feed.getTitle()); - txtvDescription.setText(feed.getDescription().trim()); + String description = feed.getDescription(); + if (description == null) { + description = ""; + } + txtvDescription.setText(description.trim()); if (feed.getAuthor() != null) { txtvAuthor.setText(feed.getAuthor()); } From 8ed3f95ec5d5c2c1b1d0d40ee3c427b92ae9f100 Mon Sep 17 00:00:00 2001 From: Tom Hennen Date: Thu, 28 May 2015 17:52:48 -0400 Subject: [PATCH 2/3] made description use a little more compact --- .../java/de/danoeh/antennapod/activity/FeedInfoActivity.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java index 9a45b7db3..5f76a20a8 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java @@ -121,10 +121,7 @@ public class FeedInfoActivity extends ActionBarActivity { txtvTitle.setText(feed.getTitle()); String description = feed.getDescription(); - if (description == null) { - description = ""; - } - txtvDescription.setText(description.trim()); + txtvDescription.setText((description != null) ? description.trim() : ""); if (feed.getAuthor() != null) { txtvAuthor.setText(feed.getAuthor()); } From 9e7bb5ce738cdfa4876824e55cc24e06572be32c Mon Sep 17 00:00:00 2001 From: Tom Hennen Date: Thu, 28 May 2015 17:54:41 -0400 Subject: [PATCH 3/3] fixed NPE on navDrawerData --- .../de/danoeh/antennapod/activity/MainActivity.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index d62612c76..0645c4620 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -365,10 +365,12 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity return -1; } else { // last fragment was not a list, but a feed long feedId = Long.parseLong(lastFragment); - List feeds = navDrawerData.feeds; - for (int i = 0; i < feeds.size(); i++) { - if (feeds.get(i).getId() == feedId) { - return i + navAdapter.getSubscriptionOffset(); + if (navDrawerData != null) { + List feeds = navDrawerData.feeds; + for (int i = 0; i < feeds.size(); i++) { + if (feeds.get(i).getId() == feedId) { + return i + navAdapter.getSubscriptionOffset(); + } } } return -1;