[Android] Fix NPE

Geoffrey Métais git at videolan.org
Tue Mar 29 11:28:13 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Mar 29 11:26:38 2016 +0200| [8ff92601242d45cda12b4310d96771e3411fed6c] | committer: Geoffrey Métais

Fix NPE

> https://code.videolan.org/videolan/vlc-android/commit/8ff92601242d45cda12b4310d96771e3411fed6c
---

 .../org/videolan/vlc/gui/browser/BaseBrowserFragment.java  | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 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 6034664..3f4326c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -318,12 +318,14 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
         mAdapter.notifyDataSetChanged();
         parseSubDirectories();
         focusHelper();
-        if (mAdapter.getMediaCount() > 0) {
-            mAddDirectoryFAB.setVisibility(View.VISIBLE);
-            mAddDirectoryFAB.setOnClickListener(this);
-        } else {
-            mAddDirectoryFAB.setVisibility(View.GONE);
-            mAddDirectoryFAB.setOnClickListener(null);
+        if (mAddDirectoryFAB != null) {
+            if (mAdapter.getMediaCount() > 0) {
+                mAddDirectoryFAB.setVisibility(View.VISIBLE);
+                mAddDirectoryFAB.setOnClickListener(this);
+            } else {
+                mAddDirectoryFAB.setVisibility(View.GONE);
+                mAddDirectoryFAB.setOnClickListener(null);
+            }
         }
     }
 



More information about the Android mailing list