[Android] Prevent NPE in browsers on device rotation

Geoffrey Métais git at videolan.org
Mon Nov 13 18:45:02 CET 2017


vlc-android | branch: 2.5.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Nov 13 18:40:44 2017 +0100| [758c200e10ddac5cbad406d4107b431efcdaa2e6] | committer: Geoffrey Métais

Prevent NPE in browsers on device rotation

(cherry picked from commit 45c45adbd5b2b8972fdc28a450333285fa878190)

> https://code.videolan.org/videolan/vlc-android/commit/758c200e10ddac5cbad406d4107b431efcdaa2e6
---

 vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 2a1695b12..5aee19028 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -245,7 +245,8 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
     public void onSaveInstanceState(Bundle outState){
         outState.putString(KEY_MRL, mMrl);
         outState.putParcelable(KEY_MEDIA, mCurrentMedia);
-        VLCApplication.storeData(KEY_MEDIA_LIST+mMrl, mAdapter.getAll());
+        if (mAdapter != null)
+            VLCApplication.storeData(KEY_MEDIA_LIST+mMrl, mAdapter.getAll());
         VLCApplication.storeData(KEY_CONTENT_LIST+mMrl, mFoldersContentLists);
         if (mRecyclerView != null)
             outState.putInt(KEY_POSITION, mLayoutManager.findFirstCompletelyVisibleItemPosition());



More information about the Android mailing list