[Android] Prevent NPE in browser menu

Geoffrey Métais git at videolan.org
Fri Apr 27 12:13:12 CEST 2018


vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Apr 27 11:26:56 2018 +0200| [7d40ed44e58aa490e6c2a90d01513fdcd0228ad3] | committer: Geoffrey Métais

Prevent NPE in browser menu

> https://code.videolan.org/videolan/vlc-android/commit/7d40ed44e58aa490e6c2a90d01513fdcd0228ad3
---

 vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 bf1e1995f..3cae82df9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -155,7 +155,8 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
     @Override
     public void onPrepareOptionsMenu(Menu menu) {
         super.onPrepareOptionsMenu(menu);
-        menu.findItem(R.id.ml_menu_filter).setVisible(enableSearchOption());
+        final MenuItem item = menu.findItem(R.id.ml_menu_filter);
+        if (item != null) item.setVisible(enableSearchOption());
     }
 
     protected int getLayoutId(){



More information about the Android mailing list