mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-21 08:59:24 +01:00
ignore negative indexes when using ListMonitor's safeIndex API
This commit is contained in:
@@ -121,13 +121,15 @@ public final class ListMonitor<T: NSManagedObject>: Hashable {
|
|||||||
!self.isPendingRefetch || NSThread.isMainThread(),
|
!self.isPendingRefetch || NSThread.isMainThread(),
|
||||||
"Attempted to access a \(cs_typeName(self)) outside the main thread while a refetch is in progress."
|
"Attempted to access a \(cs_typeName(self)) outside the main thread while a refetch is in progress."
|
||||||
)
|
)
|
||||||
|
guard sectionIndex >= 0 && itemIndex >= 0 else {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
guard let sections = self.fetchedResultsController.sections
|
guard let sections = self.fetchedResultsController.sections
|
||||||
where sectionIndex < sections.count else {
|
where sectionIndex < sections.count else {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
let section = sections[sectionIndex]
|
let section = sections[sectionIndex]
|
||||||
guard itemIndex < section.numberOfObjects else {
|
guard itemIndex < section.numberOfObjects else {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user