[Android] Fix UninitializedPropertyAccessException

Nicolas Pomepuy git at videolan.org
Wed Aug 11 06:23:28 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Aug 10 15:24:25 2021 +0200| [5b792a72a4dc2a638867000b064828d6192add19] | committer: Nicolas Pomepuy

Fix UninitializedPropertyAccessException

> https://code.videolan.org/videolan/vlc-android/commit/5b792a72a4dc2a638867000b064828d6192add19
---

 .../vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt        | 5 +++++
 .../src/org/videolan/vlc/gui/audio/AudioPlayerAnimator.kt            | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
index e0e0a9a03..21dc16b04 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
@@ -733,6 +733,11 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
         }
     }
 
+    fun retrieveAbRepeatAddMarker():Button? {
+        if (!::abRepeatAddMarker.isInitialized) return null
+        return abRepeatAddMarker
+    }
+
     private val hideSearchRunnable by lazy(LazyThreadSafetyMode.NONE) {
         Runnable {
             hideSearchField()
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerAnimator.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerAnimator.kt
index bd64d7ca8..3f6ddc313 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerAnimator.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerAnimator.kt
@@ -101,7 +101,8 @@ internal class AudioPlayerAnimator : IAudioPlayerAnimator, LifecycleObserver {
                 else -> headerHidePlaylistConstraint
             }.applyTo(binding.header)
             audioPlayer.showChips()
-            audioPlayer.playlistModel.service?.manageAbRepeatStep(binding.abRepeatReset, binding.abRepeatStop, binding.abRepeatContainer, audioPlayer.abRepeatAddMarker)
+            audioPlayer.retrieveAbRepeatAddMarker()?.let { audioPlayer.playlistModel.service?.manageAbRepeatStep(binding.abRepeatReset, binding.abRepeatStop, binding.abRepeatContainer, it) }
+
             field = value
             onSlide(1F)
         }



More information about the Android mailing list