[Android] Fix crash when dismissing the video settings disclaimer

Nicolas Pomepuy git at videolan.org
Wed Apr 30 05:10:56 UTC 2025


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Apr 29 09:10:31 2025 +0200| [90500d935f1165f696e14e8fb0a76223243f15be] | committer: Nicolas Pomepuy

Fix crash when dismissing the video settings disclaimer

> https://code.videolan.org/videolan/vlc-android/commit/90500d935f1165f696e14e8fb0a76223243f15be
---

 .../src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt         | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt
index 814b88d6e7..243e71d429 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt
@@ -26,6 +26,7 @@ import android.content.SharedPreferences
 import android.os.Bundle
 import androidx.lifecycle.lifecycleScope
 import kotlinx.coroutines.launch
+import org.videolan.resources.AppContextProvider
 import org.videolan.resources.VLCInstance
 import org.videolan.tools.POPUP_FORCE_LEGACY
 import org.videolan.tools.PREF_SHOW_VIDEO_SETTINGS_DISCLAIMER
@@ -44,9 +45,9 @@ class PreferencesVideo : BasePreferenceFragment(), SharedPreferences.OnSharedPre
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
-        if (Settings.getInstance(requireContext()).getBoolean(PREF_SHOW_VIDEO_SETTINGS_DISCLAIMER, false)) {
+        if (Settings.getInstance(requireActivity()).getBoolean(PREF_SHOW_VIDEO_SETTINGS_DISCLAIMER, false)) {
             UiTools.snackerConfirm(requireActivity(), requireActivity().getString(R.string.video_settings_disclaimer), indefinite = true) {
-                Settings.getInstance(requireContext()).putSingle(PREF_SHOW_VIDEO_SETTINGS_DISCLAIMER, false)
+                Settings.getInstance(AppContextProvider.appContext).putSingle(PREF_SHOW_VIDEO_SETTINGS_DISCLAIMER, false)
             }
         }
     }



More information about the Android mailing list