aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index ba884503..805c0de0 100644
--- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -334,12 +334,20 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
return;
}
entry = (Entry) entryList.getItemAtPosition(info.position);
- albumContext = false;
+ // When List has Grid embedded in header, this is called against the header as well
+ if(entry != null) {
+ albumContext = false;
+ }
} else {
entry = (Entry) albumList.getItemAtPosition(info.position);
albumContext = true;
}
+ // Don't try to display a context menu if error here
+ if(entry == null) {
+ return;
+ }
+
onCreateContextMenu(menu, view, menuInfo, entry);
if(!entry.isVideo() && !Util.isOffline(context) && (playlistId == null || !playlistOwner) && (podcastId == null || Util.isOffline(context) && podcastId != null)) {
menu.removeItem(R.id.song_menu_remove_playlist);
@@ -373,7 +381,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
Object selectedItem;
int headers = entryList.getHeaderViewsCount();
if(albumContext) {
- selectedItem = albums.get(info.position);
+ selectedItem = albumList.getItemAtPosition(info.position);
} else {
if(info.position == 0) {
return false;