aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-07-25 14:28:29 -0700
committerScott Jackson <daneren2005@gmail.com>2014-07-25 14:28:29 -0700
commit55c7a1a9645dfe54cbff68873792d8e82ae9c702 (patch)
tree14d5233b7f087738a80e4557205ec92c3de26b54
parentb456df109838d711e96cbb19beaacd053619b253 (diff)
downloaddsub-55c7a1a9645dfe54cbff68873792d8e82ae9c702.tar.gz
dsub-55c7a1a9645dfe54cbff68873792d8e82ae9c702.tar.bz2
dsub-55c7a1a9645dfe54cbff68873792d8e82ae9c702.zip
Fix for case where a Podcast Channel has no name
-rw-r--r--src/github/daneren2005/dsub/domain/PodcastChannel.java14
1 files changed, 12 insertions, 2 deletions
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() + " ");