[Android] Prevent IllegalStateException when the EqualizerFragment is not attached

Nicolas Pomepuy git at videolan.org
Tue Oct 5 08:11:17 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Oct  1 09:26:30 2021 +0200| [31ac8d0a32ffef2196f16d4aacda6635af61953a] | committer: Nicolas Pomepuy

Prevent IllegalStateException when the EqualizerFragment is not attached

> https://code.videolan.org/videolan/vlc-android/commit/31ac8d0a32ffef2196f16d4aacda6635af61953a
---

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

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt
index 8dc1f0dc6..7651a94df 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt
@@ -316,6 +316,7 @@ class EqualizerFragment : VLCBottomSheetDialogFragment() {
             override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { }
 
             override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
+                if (context == null) return
                 val newName = input.text.toString()
                 if (input.text.contains("_") || newName == newPresetName) {
                     input.error = getString(R.string.custom_set_wrong_input)



More information about the Android mailing list