diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-05-11 15:33:58 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-05-11 15:33:58 -0700 |
commit | 2194f97e9282ebeaa2d8d9922a7afdad25264397 (patch) | |
tree | b227ce9e7dbc0e1a5196e4ba10ed91e581ba84a6 /subsonic-android/src | |
parent | b0bbed9aa7d8d982c5f31a244208472da5468392 (diff) | |
download | dsub-2194f97e9282ebeaa2d8d9922a7afdad25264397.tar.gz dsub-2194f97e9282ebeaa2d8d9922a7afdad25264397.tar.bz2 dsub-2194f97e9282ebeaa2d8d9922a7afdad25264397.zip |
Add in a safety check if parent id is not set
Diffstat (limited to 'subsonic-android/src')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/fragments/SearchFragment.java | 21 | ||||
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java | 2 |
2 files changed, 14 insertions, 9 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SearchFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SearchFragment.java index 9821dbf2..c2fc289d 100644 --- a/subsonic-android/src/github/daneren2005/dsub/fragments/SearchFragment.java +++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SearchFragment.java @@ -282,13 +282,18 @@ public class SearchFragment extends SubsonicFragment { }
private void onAlbumSelected(MusicDirectory.Entry album, boolean autoplay) {
- SubsonicFragment parentFragment = new SelectDirectoryFragment();
- Bundle args = new Bundle();
- args.putString(Constants.INTENT_EXTRA_NAME_ID, album.getParent());
- args.putString(Constants.INTENT_EXTRA_NAME_NAME, album.getArtist());
- parentFragment.setArguments(args);
-
- replaceFragment(parentFragment, R.id.search_layout);
+ int id = R.id.search_layout;
+ Bundle args;
+ if(album.getParent() != null) {
+ SubsonicFragment parentFragment = new SelectDirectoryFragment();
+ args = new Bundle();
+ args.putString(Constants.INTENT_EXTRA_NAME_ID, album.getParent());
+ args.putString(Constants.INTENT_EXTRA_NAME_NAME, album.getArtist());
+ parentFragment.setArguments(args);
+
+ replaceFragment(parentFragment, R.id.search_layout);
+ id = R.id.select_album_layout;
+ }
SubsonicFragment fragment = new SelectDirectoryFragment();
args = new Bundle();
@@ -296,7 +301,7 @@ public class SearchFragment extends SubsonicFragment { args.putString(Constants.INTENT_EXTRA_NAME_NAME, album.getTitle());
fragment.setArguments(args);
- replaceFragment(fragment, R.id.select_album_layout);
+ replaceFragment(fragment, id);
}
private void onSongSelected(MusicDirectory.Entry song, boolean save, boolean append, boolean autoplay, boolean playNext) {
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index 5ebbd7e9..084269ee 100644 --- a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -227,7 +227,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter if (position >= 0) {
MusicDirectory.Entry entry = (MusicDirectory.Entry) parent.getItemAtPosition(position);
if (entry.isDirectory()) {
- if(albumListType != null) {
+ if(albumListType != null && entry.getParent() != null) {
SubsonicFragment parentFragment = new SelectDirectoryFragment();
Bundle args = new Bundle();
args.putString(Constants.INTENT_EXTRA_NAME_ID, entry.getParent());
|