[Android] Prevent NPE in MainActivity getCurrentFragment

Geoffrey Métais git at videolan.org
Thu Sep 21 18:36:38 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Sep 21 18:05:23 2017 +0200| [890946a8f25b0cf3822346902bd4425db89289b7] | committer: Geoffrey Métais

Prevent NPE in MainActivity getCurrentFragment

> https://code.videolan.org/videolan/vlc-android/commit/890946a8f25b0cf3822346902bd4425db89289b7
---

 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 5d94b22c6..181c051af 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -713,7 +713,7 @@ public class MainActivity extends ContentActivity implements FilterQueryProvider
         final List<Fragment> fragments = getSupportFragmentManager().getFragments();
         if (fragments != null)
             for (Fragment fragment : fragments)
-                if (!fragment.isHidden() && fragment.getClass().isInstance(mCurrentFragment))
+                if (fragment != null && !fragment.isHidden() && fragment.getClass().isInstance(mCurrentFragment))
                     return fragment;
         return mCurrentFragment;
     }



More information about the Android mailing list