Crash issue when adding Wenderland team

As you can see that it’s crashing when inserting underdog team in method

func controller(_ controller: NSFetchedResultsController,
didChange anObject: Any,
at indexPath: IndexPath?,
for type: NSFetchedResultsChangeType,
newIndexPath: IndexPath?)

This is [indexPath!] the culprit but when I check in the debugger it has some value. Now I am confused why is it crashing?
I bypass that using guard let indexPath = indexPath else { return } but I like to know the reason. If anyone can help me, por favor.
Is it I or its Xcode is being dumdum?

Thanks for reading.

Is this about using newIndexPath instead of indexPath for inserts (again)?

Yes it was. I missed it while reading the code

This topic was automatically closed after 166 days. New replies are no longer allowed.