rechsteiner / Parchment

A paging view with a highly customizable menu ✨
MIT License
3.39k stars 419 forks source link

Do safety check for selectedIndex #732

Open lutfime opened 2 months ago

lutfime commented 2 months ago

I'm passing selectedIndex binding to PageView and using dynamic items. In initial load the items is not yet loaded with 0 items, the app crash because there is no safety check in func select(index: Int, animated: Bool = false).

Another occurrence is when I dismiss the view selectedIndex is out of bound, not sure why but should check for item count and do safety check.