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

NSInvalidArgumentException: no object at index 6 in section at index 0 #23192

Closed
sentry-io bot opened this issue May 10, 2024 · 3 comments
Closed

NSInvalidArgumentException: no object at index 6 in section at index 0 #23192

sentry-io bot opened this issue May 10, 2024 · 3 comments

Comments

@sentry-io
Copy link

sentry-io bot commented May 10, 2024

Sentry Issue: WORDPRESS-IOS-46F4

NSInvalidArgumentException: no object at index 6 in section at index 0
  File "PostListViewController.swift", line 160, in PostListViewController.postAtIndexPath
  File "PostListViewController.swift", line 225, in PostListViewController.tableView
  File "<compiler-generated>", in thunk for closure
  File "main.swift", line 7, in main
...
(26 additional frame(s) were not displayed)
@dangermattic
Copy link
Collaborator

dangermattic commented May 10, 2024

Thanks for reporting! 👍

@dvdchr
Copy link
Contributor

dvdchr commented May 10, 2024

This issue has occurred 6 times, affecting 5 different users on version 24.7. The exception was thrown from this line:

guard let post = fetchResultsController.object(at: indexPath) as? Post else {
fatalError("Expected a post object.")
}

Particularly from the object(at:) method of NSFetchedResultsController, as per the documentation:

If indexPath does not describe a valid index path in the fetch results, an exception is raised.

I wonder if there's a safer way to escape this exception and use wpAssertionFailure instead... This looks like a race between the data refreshing and the table view reloading its cells while still referring to the previous set of index paths.

@dvdchr
Copy link
Contributor

dvdchr commented May 10, 2024

Closing this as duplicate of #22181, where the expected fix will be shipped in version 24.8 as per #22181 (comment).

@dvdchr dvdchr closed this as completed May 10, 2024
@dvdchr dvdchr closed this as not planned Won't fix, can't repro, duplicate, stale May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants