Fix a bug caused by NSPredicate mistake

This commit is contained in:
Bob Sun 2017-06-13 21:21:46 -07:00
parent e6f90bcc0d
commit 077e046a0e
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -213,7 +213,7 @@ class PasswordStore {
func getPasswordEntity(by path: String, isDir: Bool) -> PasswordEntity? {
let passwordEntityFetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "PasswordEntity")
do {
passwordEntityFetchRequest.predicate = NSPredicate(format: "path = %@ and isDir = %@", path, isDir.description)
passwordEntityFetchRequest.predicate = NSPredicate(format: "path = %@ and isDir = %@", path, isDir as NSNumber)
return try context.fetch(passwordEntityFetchRequest).first as? PasswordEntity
} catch {
fatalError("Failed to fetch password entities: \(error)")