From 55c7a1a9645dfe54cbff68873792d8e82ae9c702 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Fri, 25 Jul 2014 14:28:29 -0700 Subject: Fix for case where a Podcast Channel has no name --- src/github/daneren2005/dsub/domain/PodcastChannel.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/github/daneren2005/dsub/domain/PodcastChannel.java b/src/github/daneren2005/dsub/domain/PodcastChannel.java index 912b0e29..bbfd1f50 100644 --- a/src/github/daneren2005/dsub/domain/PodcastChannel.java +++ b/src/github/daneren2005/dsub/domain/PodcastChannel.java @@ -92,8 +92,18 @@ public class PodcastChannel implements Serializable { @Override public int compare(PodcastChannel podcast1, PodcastChannel podcast2) { - String lhs = podcast1.getName().toLowerCase(); - String rhs = podcast2.getName().toLowerCase(); + String lhs = podcast1.getName(); + String rhs = podcast2.getName(); + if(lhs == null && rhs == null) { + return 0; + } else if(lhs == null) { + return 1; + } else if(rhs == null) { + return -1; + } + + lhs = lhs.toLowerCase(); + rhs = rhs.toLowerCase(); for(String article: ignoredArticles) { int index = lhs.indexOf(article.toLowerCase() + " "); -- cgit v1.2.3