[Android] Equalizer: Prevent NPE
Geoffrey Métais
git at videolan.org
Wed Nov 13 10:29:20 CET 2019
vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Nov 12 17:37:55 2019 +0100| [e077e79212bf53cf6527580937644ce44a524278] | committer: Geoffrey Métais
Equalizer: Prevent NPE
(cherry picked from commit b504377e74db6fbcc7af2403bc4cfb18698ff7c0)
> https://code.videolan.org/videolan/vlc-android/commit/e077e79212bf53cf6527580937644ce44a524278
---
vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt b/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt
index 31ddc5c5c..5c9c3037a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt
@@ -195,9 +195,10 @@ class EqualizerFragment : VLCBottomSheetDialogFragment(), CoroutineScope by Main
// Set the default selection asynchronously to prevent a layout initialization bug.
binding.equalizerPresets.post {
+ val activity = activity ?: return at post
binding.equalizerPresets.onItemSelectedListener = setListener
- val pos = allSets.indexOf(VLCOptions.getEqualizerNameFromSettings(requireActivity()))
- state.update(pos, VLCOptions.getEqualizerSavedState(requireActivity()))
+ val pos = allSets.indexOf(VLCOptions.getEqualizerNameFromSettings(activity))
+ state.update(pos, VLCOptions.getEqualizerSavedState(activity))
updateAlreadyHandled = true
if (binding.equalizerButton.isChecked || !state.saved) {
savePos = pos
More information about the Android
mailing list