diff options
author | Charles Lombardo <[email protected]> | 2023-09-26 20:13:12 -0400 |
---|---|---|
committer | Charles Lombardo <[email protected]> | 2023-09-27 13:40:09 -0400 |
commit | 22284fc5041b7ad307b50811cd11e6e4d5dbc926 (patch) | |
tree | 11c8e59cbbadb94aa5a64b6e8987d141733e42e9 /src | |
parent | d70f18b87b03cf9ab908f2294a49a0f57684e230 (diff) | |
download | yuzu-mainline-22284fc5041b7ad307b50811cd11e6e4d5dbc926.tar.gz yuzu-mainline-22284fc5041b7ad307b50811cd11e6e4d5dbc926.zip |
android: Prevent crash when trying to change pages in setup fragment
Sometimes when we want to change the current setup page, the current view isn't available and we try to alter the current view. This adds a guard to prevent that issue.
Diffstat (limited to 'src')
-rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt index 6bb6a4464..c66bb635a 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt @@ -355,11 +355,15 @@ class SetupFragment : Fragment() { } fun pageForward() { - binding.viewPager2.currentItem = binding.viewPager2.currentItem + 1 + if (_binding != null) { + binding.viewPager2.currentItem += 1 + } } fun pageBackward() { - binding.viewPager2.currentItem = binding.viewPager2.currentItem - 1 + if (_binding != null) { + binding.viewPager2.currentItem -= 1 + } } fun setPageWarned(page: Int) { |