Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: picker crash #63

Merged
merged 1 commit into from
Aug 9, 2024
Merged

fix: picker crash #63

merged 1 commit into from
Aug 9, 2024

Conversation

forgotvas
Copy link
Collaborator

this PR fix crash when after filter applying PickerView crash with index out of bounds error.

@forgotvas forgotvas requested review from rnr and saeedbashir August 8, 2024 20:29
Copy link

@shafqat-muneer shafqat-muneer Aug 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In response to the /v1/account/registration/ API, we're consistently receiving an empty element.

{
     "value": "",
     "name": "--",
     "default": true
}

Considering this, we could simplify the solution to a single line change.

let filteredItems = items.filter { $0.value.localizedCaseInsensitiveContains(search) }
return filteredItems.isEmpty ? [PickerItem(key: "", value: "")] : filteredItem

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, i saw that, but just noticed that this PickerView is using from different places.. from subtitles view for example.

Copy link

@saeedbashir saeedbashir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@forgotvas forgotvas merged commit 0fdc9b2 into 2U/develop Aug 9, 2024
3 checks passed
@forgotvas forgotvas deleted the fix/picker-crash branch August 12, 2024 05:21
saeedbashir pushed a commit that referenced this pull request Aug 20, 2024
rnr pushed a commit that referenced this pull request Sep 6, 2024
rnr added a commit that referenced this pull request Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants