forked from ShuriZma/suyu
1
0
Fork 0

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.
This commit is contained in:
Charles Lombardo 2023-09-26 20:13:12 -04:00
parent d70f18b87b
commit 22284fc504
1 changed files with 6 additions and 2 deletions

View File

@ -355,11 +355,15 @@ class SetupFragment : Fragment() {
} }
fun pageForward() { fun pageForward() {
binding.viewPager2.currentItem = binding.viewPager2.currentItem + 1 if (_binding != null) {
binding.viewPager2.currentItem += 1
}
} }
fun pageBackward() { fun pageBackward() {
binding.viewPager2.currentItem = binding.viewPager2.currentItem - 1 if (_binding != null) {
binding.viewPager2.currentItem -= 1
}
} }
fun setPageWarned(page: Int) { fun setPageWarned(page: Int) {