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

Update ListSelectorViewController to use safe index accessors #14077

Merged
merged 1 commit into from
Sep 30, 2024

Conversation

Ecarrion
Copy link
Contributor

@Ecarrion Ecarrion commented Sep 30, 2024

Closes: #14070
peaMlT-Vj-p2

Context

command.data[indexPath.row] should never fail as the dataset does not mutate, but according to crash reports it does.
I assume that this happens when the view is used in a SwiftUI hosting environment and some variables could be updated or mutated due to the underlying view lifecycle, causing the command data to be inconsistent with the current index path.

How

  • Updates ListSelectorViewController to use safe index accessors to prevent any out of index crash.

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on all devices (phone/tablet) and no regressions are added.

@Ecarrion Ecarrion added the type: crash The worst kind of bug. label Sep 30, 2024
@Ecarrion Ecarrion added this to the 20.7 milestone Sep 30, 2024
@Ecarrion Ecarrion self-assigned this Sep 30, 2024
@wpmobilebot
Copy link
Collaborator

WooCommerce iOS📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr14077-b25ba6a
Version20.6
Bundle IDcom.automattic.alpha.woocommerce
Commitb25ba6a
App Center BuildWooCommerce - Prototype Builds #11063
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@Ecarrion Ecarrion merged commit bc4301b into trunk Sep 30, 2024
18 of 19 checks passed
@Ecarrion Ecarrion deleted the issue/14070-list-selector-crash branch September 30, 2024 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: crash The worst kind of bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EXC_BREAKPOINT: Fatal error > Index out of range
2 participants