Fixes error fetching Friend Zone patrons due to unexpected nil name

This commit is contained in:
Riley Testut
2023-03-28 14:37:47 -05:00
committed by Magesh K
parent 06d28ca663
commit 404bd1450b
3 changed files with 8 additions and 5 deletions

View File

@@ -19,11 +19,14 @@ public class ManagedPatron: NSManagedObject, Fetchable
super.init(entity: entity, insertInto: context)
}
public init(patron: Patron, context: NSManagedObjectContext)
public init?(patron: Patron, context: NSManagedObjectContext)
{
// Only cache Patrons with non-nil names.
guard let name = patron.name else { return nil }
super.init(entity: ManagedPatron.entity(), insertInto: context)
self.name = patron.name
self.name = name
self.identifier = patron.identifier
}
}