[Android] Browser: prevent IndexOutOfBoundsException
Geoffrey Métais
git at videolan.org
Tue May 12 09:00:26 CEST 2020
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon May 11 15:58:08 2020 +0200| [1f6ffd8f6839f98732e319468b2c07d8ff0cec0e] | committer: Nicolas Pomepuy
Browser: prevent IndexOutOfBoundsException
> https://code.videolan.org/videolan/vlc-android/commit/1f6ffd8f6839f98732e319468b2c07d8ff0cec0e
---
.../src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt | 1 +
.../src/org/videolan/vlc/gui/browser/MediaBrowserFragment.kt | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
index bc61c0c3d..34acaa048 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
@@ -575,6 +575,7 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
override fun onMainActionClick(v: View, position: Int, item: MediaLibraryItem) {}
override fun onUpdateFinished(adapter: RecyclerView.Adapter<*>) {
+ if (!isStarted()) return
restoreMultiSelectHelper()
swipeRefreshLayout.isRefreshing = false
handler.sendEmptyMessage(MSG_HIDE_LOADING)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.kt
index c9473b68b..31c089a12 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.kt
@@ -106,6 +106,11 @@ abstract class MediaBrowserFragment<T : SortableModel> : BaseFragment(), Filtera
releaseBreadCrumb()
}
+ override fun onDestroy() {
+ super.onDestroy()
+ savedSelection.clear()
+ }
+
override fun onSaveInstanceState(outState: Bundle) {
getMultiHelper()?.let {
outState.putParcelable(KEY_SELECTION, SparseBooleanArrayParcelable(it.selectionMap))
More information about the Android
mailing list