[Android] Fix NPE on TV

Geoffrey Métais git at videolan.org
Fri Jan 13 10:44:43 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jan 13 10:44:29 2017 +0100| [6814ebdcdfaf352e41535e261da9c066f4b4e687] | committer: Geoffrey Métais

Fix NPE on TV

> https://code.videolan.org/videolan/vlc-android/commit/6814ebdcdfaf352e41535e261da9c066f4b4e687
---

 .../org/videolan/vlc/gui/browser/StorageBrowserFragment.java   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java
index 992c722..80b91d2 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java
@@ -76,7 +76,7 @@ public class StorageBrowserFragment extends FileBrowserFragment {
     @Override
     public void onStart() {
         super.onStart();
-        if (mRoot) {
+        if (mRoot && mFabPlay != null) {
             mFabPlay.setImageResource(R.drawable.ic_fab_add);
             mFabPlay.setOnClickListener(this);
         }
@@ -85,15 +85,17 @@ public class StorageBrowserFragment extends FileBrowserFragment {
     @Override
     public void onStop() {
         super.onStop();
-        mFabPlay.setVisibility(View.GONE);
-        mFabPlay.setOnClickListener(null);
+        if (mFabPlay != null) {
+            mFabPlay.setVisibility(View.GONE);
+            mFabPlay.setOnClickListener(null);
+        }
     }
 
     @Override
     public void onViewCreated(View view, Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
         if (VLCApplication.showTvUi()) {
-            if (mRoot)
+            if (mRoot && mFabPlay != null)
                 mFabPlay.requestFocus();
             else
                 mRecyclerView.requestFocus();



More information about the Android mailing list