[Android] Equalizer: Prevent NPE
Geoffrey Métais
git at videolan.org
Tue Nov 12 17:46:22 CET 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Nov 12 17:37:55 2019 +0100| [b504377e74db6fbcc7af2403bc4cfb18698ff7c0] | committer: Geoffrey Métais
Equalizer: Prevent NPE
> https://code.videolan.org/videolan/vlc-android/commit/b504377e74db6fbcc7af2403bc4cfb18698ff7c0
---
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