[Android] Prevent NPE in browser menu
Geoffrey Métais
git at videolan.org
Fri Apr 27 14:55:16 CEST 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Apr 27 11:26:56 2018 +0200| [f0626baf5ee1c66bed9eabae054169ac485f44ea] | committer: Geoffrey Métais
Prevent NPE in browser menu
> https://code.videolan.org/videolan/vlc-android/commit/f0626baf5ee1c66bed9eabae054169ac485f44ea
---
.../src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
index a4b2721af..fe7759549 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -114,8 +114,10 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment<BrowserPr
@Override
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
- menu.findItem(R.id.ml_menu_filter).setVisible(enableSearchOption());
- menu.findItem(R.id.ml_menu_sortby).setVisible(!mRoot);
+ final MenuItem item = menu.findItem(R.id.ml_menu_filter);
+ if (item != null) item.setVisible(enableSearchOption());
+ final MenuItem sortItem = menu.findItem(R.id.ml_menu_sortby);
+ if (sortItem != null) sortItem.setVisible(!mRoot);
}
protected boolean defineIsRoot() {
More information about the Android
mailing list