forked from ShuriZma/suyu
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
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue