aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-08-04 12:20:27 -0700
committerScott Jackson <daneren2005@gmail.com>2015-08-04 12:20:27 -0700
commit364ab1f49d73523273ed4324c15367ccb5cfd506 (patch)
tree62e56b429c11968f49d324b530f600061f2157d8 /app
parent2b43f16c6563f3533be1a435850ea4905f663ec5 (diff)
downloaddsub-364ab1f49d73523273ed4324c15367ccb5cfd506.tar.gz
dsub-364ab1f49d73523273ed4324c15367ccb5cfd506.tar.bz2
dsub-364ab1f49d73523273ed4324c15367ccb5cfd506.zip
Fix crash in moreButton but no context menu handler
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java b/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java
index 2dbdf1f1..f0181347 100644
--- a/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java
+++ b/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java
@@ -221,11 +221,15 @@ public abstract class SectionAdapter<T> extends RecyclerView.Adapter<UpdateViewH
moreButton = updateView.findViewById(R.id.item_more);
}
if(moreButton != null) {
- PopupMenu popup = new PopupMenu(context, moreButton);
- Menu menu = popup.getMenu();
- onItemClickedListener.onCreateContextMenu(popup.getMenu(), popup.getMenuInflater(), updateView, item);
- if(menu.size() == 0) {
- moreButton.setVisibility(View.GONE);
+ if(onItemClickedListener != null) {
+ PopupMenu popup = new PopupMenu(context, moreButton);
+ Menu menu = popup.getMenu();
+ onItemClickedListener.onCreateContextMenu(popup.getMenu(), popup.getMenuInflater(), updateView, item);
+ if (menu.size() == 0) {
+ moreButton.setVisibility(View.GONE);
+ } else {
+ moreButton.setVisibility(View.VISIBLE);
+ }
} else {
moreButton.setVisibility(View.VISIBLE);
}