diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-09-21 15:51:11 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-09-21 15:51:11 -0700 |
commit | c2cf538288a28880d079f812fff9b24790ee8d94 (patch) | |
tree | accd58a5e0ce0fc294da991e8063e7c257d21ca1 | |
parent | a3f983629f092d880cc2861bb57cf101bbe511b2 (diff) | |
download | dsub-c2cf538288a28880d079f812fff9b24790ee8d94.tar.gz dsub-c2cf538288a28880d079f812fff9b24790ee8d94.tar.bz2 dsub-c2cf538288a28880d079f812fff9b24790ee8d94.zip |
Fix crash with child somehow being null
-rw-r--r-- | src/github/daneren2005/dsub/domain/MusicDirectory.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/github/daneren2005/dsub/domain/MusicDirectory.java b/src/github/daneren2005/dsub/domain/MusicDirectory.java index c7e00719..79472a89 100644 --- a/src/github/daneren2005/dsub/domain/MusicDirectory.java +++ b/src/github/daneren2005/dsub/domain/MusicDirectory.java @@ -73,9 +73,11 @@ public class MusicDirectory implements Serializable { this.parent = parent; } - public void addChild(Entry child) { - children.add(child); - } + public void addChild(Entry child) { + if(child != null) { + children.add(child); + } + } public void addChildren(List<Entry> children) { this.children.addAll(children); } @@ -95,7 +97,7 @@ public class MusicDirectory implements Serializable { List<Entry> result = new ArrayList<Entry>(children.size()); for (Entry child : children) { - if (child.isDirectory() && includeDirs || !child.isDirectory() && includeFiles) { + if (child != null && child.isDirectory() && includeDirs || !child.isDirectory() && includeFiles) { result.add(child); } } |