mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 06:42:46 +01:00
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:
parent
d70f18b87b
commit
22284fc504
1 changed files with 6 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue