[Android] Prevent NPE in getCurrentFragment

Geoffrey Métais git at videolan.org
Thu Sep 28 10:53:32 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Sep 28 09:18:36 2017 +0200| [5e35cd81d3e804ff6c4b3328c75f2406fd21fb2f] | committer: Geoffrey Métais

Prevent NPE in getCurrentFragment

> https://code.videolan.org/videolan/vlc-android/commit/5e35cd81d3e804ff6c4b3328c75f2406fd21fb2f
---

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 181c051af..3b0352468 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -708,7 +708,7 @@ public class MainActivity extends ContentActivity implements FilterQueryProvider
 
     private Fragment getFirstVisibleFragment() {
         final Fragment frag = getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder);
-        if (!frag.isHidden())
+        if (frag != null && !frag.isHidden())
             return frag;
         final List<Fragment> fragments = getSupportFragmentManager().getFragments();
         if (fragments != null)



More information about the Android mailing list