Make FeedItemUtil.getLinkWithFallback(item) tolerates null item.
This commit is contained in:
parent
345fcc17d0
commit
ab0f413185
|
@ -81,13 +81,16 @@ public class FeedItemUtil {
|
|||
* use the feed's link if the named feed item has no link.
|
||||
*/
|
||||
public static String getLinkWithFallback(FeedItem item) {
|
||||
String link = item.getLink();
|
||||
if (link == null) {
|
||||
Feed feed = item.getFeed();
|
||||
if (feed != null) {
|
||||
link = feed.getLink();
|
||||
String link = null;
|
||||
if (item != null) {
|
||||
link = item.getLink();
|
||||
if (link == null) {
|
||||
Feed feed = item.getFeed();
|
||||
if (feed != null) {
|
||||
link = feed.getLink();
|
||||
}
|
||||
}
|
||||
}
|
||||
} // else null item, can only return null
|
||||
return link;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ShareUtils {
|
|||
}
|
||||
|
||||
public static boolean hasLinkToShare(FeedItem item) {
|
||||
return ( item != null && FeedItemUtil.getLinkWithFallback(item) != null );
|
||||
return FeedItemUtil.getLinkWithFallback(item) != null;
|
||||
}
|
||||
|
||||
public static void shareFeedItemLink(Context context, FeedItem item, boolean withPosition) {
|
||||
|
|
Loading…
Reference in New Issue