[Android] Prevent crash with AudioBrowserFragment empty view update

Nicolas Pomepuy git at videolan.org
Tue Apr 18 11:24:41 UTC 2023


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Apr 17 07:04:42 2023 +0200| [879d8bf65cf329e23527efc33521cff26024f114] | committer: Nicolas Pomepuy

Prevent crash with AudioBrowserFragment empty view update

> https://code.videolan.org/videolan/vlc-android/commit/879d8bf65cf329e23527efc33521cff26024f114
---

 .../vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt   | 1 +
 1 file changed, 1 insertion(+)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
index 5ae8e6947a..d38f76d29b 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
@@ -323,6 +323,7 @@ class AudioBrowserFragment : BaseAudioBrowser<AudioBrowserViewModel>() {
     override fun enableSearchOption() = true
 
     private fun updateEmptyView() {
+        if (!isAdded) return
         swipeRefreshLayout.visibility = if (Medialibrary.getInstance().isInitiated) View.VISIBLE else View.GONE
         emptyView.emptyText = viewModel.filterQuery?.let {  getString(R.string.empty_search, it) } ?: if (viewModel.providers[currentTab].onlyFavorites) getString(R.string.nofav) else getString(R.string.nomedia)
         emptyView.state = when {



More information about the Android mailing list