[Android] Browser: prevent IndexOutOfBoundsException
Geoffrey Métais
git at videolan.org
Mon Jun 29 07:02:04 CEST 2020
vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Apr 27 17:12:36 2020 +0200| [a9469522c098d9f665bd2ed66399b395a2c199c3] | committer: Nicolas Pomepuy
Browser: prevent IndexOutOfBoundsException
> https://code.videolan.org/videolan/vlc-android/commit/a9469522c098d9f665bd2ed66399b395a2c199c3
---
vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt | 1 +
vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.kt | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
index 50d4c8a84..4d67c8825 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
@@ -487,6 +487,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/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.kt b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.kt
index b08a342c2..594c63dde 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.kt
@@ -138,6 +138,11 @@ abstract class MediaBrowserFragment<T : SortableModel> : Fragment(), ActionMode.
setFabPlayVisibility(false)
}
+ 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