[Android] AudioAlbumSongsFragment: Fix NPE

Geoffrey Métais git at videolan.org
Mon Feb 19 14:59:31 CET 2018


vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Feb 19 14:56:31 2018 +0100| [20ca3b3f4e730f2382ff9bc59437a953ce52dbe0] | committer: Geoffrey Métais

AudioAlbumSongsFragment: Fix NPE

(cherry picked from commit 45812a96a9373a89ff17babc1baf6a18de0e9fef)

> https://code.videolan.org/videolan/vlc-android/commit/20ca3b3f4e730f2382ff9bc59437a953ce52dbe0
---

 .../src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java     | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
index 81dc278ce..c7cbe547c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
@@ -26,6 +26,7 @@ import android.os.Bundle;
 import android.os.Handler;
 import android.os.Looper;
 import android.support.design.widget.TabLayout;
+import android.support.v4.app.FragmentActivity;
 import android.support.v4.app.FragmentManager;
 import android.support.v4.view.ViewPager;
 import android.support.v7.widget.LinearLayoutManager;
@@ -349,7 +350,9 @@ public class AudioAlbumsSongsFragment extends BaseAudioBrowser implements SwipeR
 
     @Override
     public void onTabSelected(TabLayout.Tab tab) {
-        getActivity().supportInvalidateOptionsMenu();
+        final FragmentActivity activity = getActivity();
+        if (activity == null) return;
+        activity.supportInvalidateOptionsMenu();
         mFastScroller.setRecyclerView(mLists[tab.getPosition()]);
     }
 



More information about the Android mailing list